nice-commit Mailing List for The Nice Programming Language (Page 60)
Brought to you by:
bonniot
You can subscribe to this list here.
2003 |
Jan
|
Feb
(60) |
Mar
(125) |
Apr
(183) |
May
(140) |
Jun
(227) |
Jul
(141) |
Aug
(181) |
Sep
(75) |
Oct
(89) |
Nov
(187) |
Dec
(162) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2004 |
Jan
(69) |
Feb
(197) |
Mar
(98) |
Apr
(26) |
May
(10) |
Jun
(85) |
Jul
(88) |
Aug
(79) |
Sep
(80) |
Oct
(81) |
Nov
(53) |
Dec
(109) |
2005 |
Jan
(68) |
Feb
(77) |
Mar
(232) |
Apr
(79) |
May
(37) |
Jun
(37) |
Jul
(3) |
Aug
(18) |
Sep
|
Oct
|
Nov
|
Dec
|
2006 |
Jan
(10) |
Feb
|
Mar
(4) |
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
(2) |
Nov
(1) |
Dec
(9) |
2007 |
Jan
(2) |
Feb
(8) |
Mar
(2) |
Apr
(5) |
May
|
Jun
|
Jul
|
Aug
(4) |
Sep
|
Oct
|
Nov
(17) |
Dec
(6) |
2008 |
Jan
|
Feb
(3) |
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
2011 |
Jan
|
Feb
|
Mar
|
Apr
(1) |
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
From: <bo...@us...> - 2004-02-05 16:19:52
|
Update of /cvsroot/nice/swing In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv21625 Modified Files: project.properties Log Message: Make maven:scm use the ssh access to the CVS repository, to avoid the delay with anonymous cvs. Index: project.properties =================================================================== RCS file: /cvsroot/nice/swing/project.properties,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** project.properties 5 Feb 2004 15:20:45 -0000 1.1 --- project.properties 5 Feb 2004 16:17:14 -0000 1.2 *************** *** 8,9 **** --- 8,15 ---- maven.multiproject.includes = examples/*/project.xml + + maven.scm.ignore.pom.connection = true + maven.scm.method = cvs + maven.scm.cvs.rsh = ssh + maven.scm.cvs.root = :ext:${maven.username}@cvs.nice.sourceforge.net:/cvsroot/nice + maven.scm.cvs.module = swing |
From: <bo...@us...> - 2004-02-05 15:23:18
|
Update of /cvsroot/nice/swing/examples In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv5494/examples Added Files: project-template.xml Log Message: Maven support for building the examples and uploading to the nice.sf.net repository. --- NEW FILE: project-template.xml --- <?xml version="1.0" encoding="latin1" ?> <project> <extend>../project.xml</extend> <name>Nice-swing examples</name> <id>nice-swing-examples</id> <currentVersion>0.1</currentVersion> <shortDescription> Example programs using the Swing adapter for Nice </shortDescription> <description> This project contains four small example programs that use Nice-swing to display a user-interface. </description> <siteDirectory> /home/groups/n/ni/nice/htdocs/packages/swing-examples </siteDirectory> <distributionDirectory> /home/groups/n/ni/nice/packages/builds </distributionDirectory> <repository> <connection> scm:cvs:pserver:ano...@cv...:/cvsroot/nice:swing/examples </connection> <url> http://cvs.sourceforge.net/viewcvs.py/nice/swing/examples </url> </repository> <build> <sourceDirectory>../..</sourceDirectory> <unitTestSourceDirectory>../test</unitTestSourceDirectory> <!-- Unit test cases --> <unitTest> <includes> <include>**/*Test.java</include> </includes> <excludes> <exclude>**/RepositoryTest.java</exclude> </excludes> </unitTest> <!-- J A R R E S O U R C E S --> <!-- Resources that are packaged up inside the JAR file --> <resources> </resources> <!-- Integration unit test cases --> <integrationUnitTest/> <jars> </jars> </build> <dependencies> <dependency> <groupId>nice</groupId> <artifactId>nice-swing</artifactId> <version>SNAPSHOT</version> <url>http://nice.sf.net/maven</url> <properties> <classloader>root</classloader> </properties> </dependency> </dependencies> </project> |
From: <bo...@us...> - 2004-02-05 15:23:18
|
Update of /cvsroot/nice/swing In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv5494 Modified Files: project.xml Added Files: project.properties maven.xml Log Message: Maven support for building the examples and uploading to the nice.sf.net repository. --- NEW FILE: project.properties --- # ------------------------------------------------------------------- # P R O J E C T P R O P E R T I E S # ------------------------------------------------------------------- maven.repo.central=nice.sf.net maven.repo.central.directory=/home/groups/n/ni/nice/htdocs/maven maven.remote.group=nice maven.multiproject.includes = examples/*/project.xml --- NEW FILE: maven.xml --- <project default="all" xmlns:j="jelly:core" xmlns:u="jelly:util"> <goal name="all"> <attainGoal name="jar:install-snapshot" /> <!-- <j:set var="maven.jar.override" value="on" /> <j:set var="maven.jar.${pom.id}" value="${maven.build.dir}/${maven.final.name}.jar" /> --> <j:set var="goal" value="nice" /> <attainGoal name="multiproject:goal" /> </goal> </project> Index: project.xml =================================================================== RCS file: /cvsroot/nice/swing/project.xml,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** project.xml 30 Jan 2004 15:53:16 -0000 1.1 --- project.xml 5 Feb 2004 15:20:45 -0000 1.2 *************** *** 4,8 **** <name>Swing adapter for Nice</name> <id>nice-swing</id> ! <currentVersion>0.1</currentVersion> <organization> <name>The Nice project</name> --- 4,9 ---- <name>Swing adapter for Nice</name> <id>nice-swing</id> ! <currentVersion>SNAPSHOT</currentVersion> ! <groupId>nice</groupId> <organization> <name>The Nice project</name> |
From: <bo...@us...> - 2004-02-05 15:23:17
|
Update of /cvsroot/nice/swing/examples/events In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv5494/examples/events Added Files: project.xml Log Message: Maven support for building the examples and uploading to the nice.sf.net repository. --- NEW FILE: project.xml --- <?xml version="1.0" encoding="latin1" ?> <project> <extend>../project-template.xml</extend> <name>Nice-swing event example</name> <id>nice-swing-event-example</id> <package>examples.events</package> <shortDescription> Example programs using the Swing adapter for Nice </shortDescription> <description> This project contains four small example programs that use Nice-swing to display a user-interface. </description> </project> |
From: <bo...@us...> - 2004-02-05 15:23:17
|
Update of /cvsroot/nice/swing/examples/helloworld In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv5494/examples/helloworld Added Files: project.xml Log Message: Maven support for building the examples and uploading to the nice.sf.net repository. --- NEW FILE: project.xml --- <?xml version="1.0" encoding="latin1" ?> <project> <extend>../project-template.xml</extend> <name>Nice-swing hello world example</name> <id>nice-swing-helloworld-example</id> <package>examples.helloworld</package> <shortDescription> Example programs using the Swing adapter for Nice </shortDescription> <description> This project contains four small example programs that use Nice-swing to display a user-interface. </description> </project> |
From: <ar...@us...> - 2004-02-04 06:00:21
|
Update of /cvsroot/nice/Nice/src/nice/tools/util In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv21084/F:/nice/src/nice/tools/util Modified Files: source-lines.nice Log Message: Use reflection in printStackTraceWithSourceInfo. Index: source-lines.nice =================================================================== RCS file: /cvsroot/nice/Nice/src/nice/tools/util/source-lines.nice,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** source-lines.nice 3 Feb 2004 01:45:51 -0000 1.2 --- source-lines.nice 3 Feb 2004 16:08:19 -0000 1.3 *************** *** 20,23 **** --- 20,24 ---- import java.io.*; + import nice.lang.reflect; public void printStackTraceWithSourceInfo(Throwable t) = *************** *** 27,44 **** printStackTraceWithSourceInfo(t, new PrintWriter(s)); public void printStackTraceWithSourceInfo(Throwable t, PrintWriter w) { w.println("Exception in thread \"" Thread.currentThread().getName "\" " t); try { ! let elements = t.getStackTrace(); ! elements.foreach(StackTraceElement e => { (?String file, int line) = ! getSourceLocation(e.getClassName(), e.getLineNumber()) ! || (e.getFileName(), e.getLineNumber()); let location = ! file == null ? (e.isNativeMethod ? "Native Method" : "Unknown Source") : line < 0 ? file : (file + ":" + line); ! w.println("\tat " e.getClassName "." e.getMethodName "(" location ")"); }); } catch (NoSuchMethodError e) { --- 28,52 ---- printStackTraceWithSourceInfo(t, new PrintWriter(s)); + String STE_getClassName(Object ste) = ste.call("getClassName"); + ?String STE_getFileName(Object ste) = ste.call("getFileName"); + String STE_getMethodName(Object ste) = ste.call("getMethodName"); + int STE_getLineNumber(Object ste) = ste.call("getLineNumber"); + boolean STE_isNativeMethod(Object ste) = ste.call("isNativeMethod"); + public void printStackTraceWithSourceInfo(Throwable t, PrintWriter w) { w.println("Exception in thread \"" Thread.currentThread().getName "\" " t); try { ! let getSTMethod = t.getClass().getMethod("getStackTrace", null); ! let Object[] elements = cast(getSTMethod.invoke(t, null)); ! elements.foreach(Object e => { (?String file, int line) = ! getSourceLocation(e.STE_getClassName(), e.STE_getLineNumber()) ! || (e.STE_getFileName(), e.STE_getLineNumber()); let location = ! file == null ? (e.STE_isNativeMethod ? "Native Method" : "Unknown Source") : line < 0 ? file : (file + ":" + line); ! w.println("\tat " e.STE_getClassName "." e.STE_getMethodName "(" location ")"); }); } catch (NoSuchMethodError e) { |
From: <xo...@us...> - 2004-02-04 01:44:32
|
Update of /cvsroot/nice/Nice/web In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv740/web Modified Files: manual.xml Log Message: Minor corrections. Index: manual.xml =================================================================== RCS file: /cvsroot/nice/Nice/web/manual.xml,v retrieving revision 1.34 retrieving revision 1.35 diff -C2 -d -r1.34 -r1.35 *** manual.xml 2 Feb 2004 22:39:47 -0000 1.34 --- manual.xml 3 Feb 2004 19:11:07 -0000 1.35 *************** *** 325,329 **** however. In Nice, an interface doesn't really "contain" anything at all, it's just a marker. ! Just as <literal>java.util.Serializable</literal> is just a tag to tell Java that it's okay to use serialization on instances of a class, all Nice interfaces are really tags. --- 325,329 ---- however. In Nice, an interface doesn't really "contain" anything at all, it's just a marker. ! Just as <literal>java.io.Serializable</literal> is just a tag to tell Java that it's okay to use serialization on instances of a class, all Nice interfaces are really tags. *************** *** 670,674 **** <T> int containsHowMany(?List<T> list); ! <T> containsHowMany(list) = list.notNull.size(); containsHowMany(null) = 0; --- 670,674 ---- <T> int containsHowMany(?List<T> list); ! <T> containsHowMany(List list) = list.size(); containsHowMany(null) = 0; |
From: <bo...@us...> - 2004-02-03 12:12:44
|
Update of /cvsroot/nice/Nice/testsuite/compiler/classes/constructors In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv14118/testsuite/compiler/classes/constructors Modified Files: compilation.testsuite Log Message: Make sure that constructors imported from compiled packages are available early enough for all uses. Index: compilation.testsuite =================================================================== RCS file: /cvsroot/nice/Nice/testsuite/compiler/classes/constructors/compilation.testsuite,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** compilation.testsuite 15 Jan 2004 21:39:19 -0000 1.8 --- compilation.testsuite 3 Feb 2004 12:09:59 -0000 1.9 *************** *** 83,84 **** --- 83,98 ---- /// package d import a,c AA<?String> dummy = new AA(x:null); + + + /// PASS + /// package a + /// Toplevel + public class A + { + private B b = new B(); + } + + public class B { } + + /// package b import a + {} |
From: <bo...@us...> - 2004-02-03 12:12:22
|
Update of /cvsroot/nice/Nice/src/bossa/syntax In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv14118/src/bossa/syntax Modified Files: CustomConstructor.java Log Message: Make sure that constructors imported from compiled packages are available early enough for all uses. Index: CustomConstructor.java =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/syntax/CustomConstructor.java,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** CustomConstructor.java 22 Dec 2003 20:28:10 -0000 1.11 --- CustomConstructor.java 3 Feb 2004 12:10:01 -0000 1.12 *************** *** 267,275 **** super(def, FormalParameters.readBytecodeAttribute(attr)); this.method = method; } void resolve() { - TypeConstructors.addConstructor(classe.definition.tc, this); addConstructorCallSymbol(); } --- 267,275 ---- super(def, FormalParameters.readBytecodeAttribute(attr)); this.method = method; + TypeConstructors.addConstructor(classe.definition.tc, this); } void resolve() { addConstructorCallSymbol(); } |
From: <bo...@us...> - 2004-02-03 10:23:06
|
Update of /cvsroot/nice/Nice/testsuite/compiler/overloading In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv20990/testsuite/compiler/overloading Modified Files: ambiguity.testsuite Log Message: Avoid infinite recursion when dealing with ambiguity between several global variables. Index: ambiguity.testsuite =================================================================== RCS file: /cvsroot/nice/Nice/testsuite/compiler/overloading/ambiguity.testsuite,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** ambiguity.testsuite 18 Jan 2004 18:33:42 -0000 1.2 --- ambiguity.testsuite 3 Feb 2004 10:20:47 -0000 1.3 *************** *** 5,6 **** --- 5,12 ---- var int foo = 0; int foo() = 1; + + /// FAIL + let i = /*/// FAIL HERE */ foo; + /// TOPLEVEL + let int foo = 0; + let String foo = ""; |
From: <bo...@us...> - 2004-02-03 10:23:06
|
Update of /cvsroot/nice/Nice/src/bossa/syntax In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv20990/src/bossa/syntax Modified Files: OverloadedSymbolExp.java Log Message: Avoid infinite recursion when dealing with ambiguity between several global variables. Index: OverloadedSymbolExp.java =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/syntax/OverloadedSymbolExp.java,v retrieving revision 1.65 retrieving revision 1.66 diff -C2 -d -r1.65 -r1.66 *** OverloadedSymbolExp.java 18 Jan 2004 20:38:40 -0000 1.65 --- OverloadedSymbolExp.java 3 Feb 2004 10:20:48 -0000 1.66 *************** *** 316,320 **** } ! if (globalvars.size() > 0) return new OverloadedSymbolExp(globalvars, ident).noOverloading(); --- 316,322 ---- } ! // If there are global variables, give them the priority ! // (but not when there are *only* global variables, or it would loop). ! if (globalvars.size() > 0 && globalvars.size() < symbols.size()) return new OverloadedSymbolExp(globalvars, ident).noOverloading(); |
From: <bo...@us...> - 2004-02-03 01:48:01
|
Update of /cvsroot/nice/Nice/src/nice/tools/util In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv19293/src/nice/tools/util Modified Files: source-lines.nice Log Message: Get the source line number right in limit cases. Index: source-lines.nice =================================================================== RCS file: /cvsroot/nice/Nice/src/nice/tools/util/source-lines.nice,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** source-lines.nice 23 Jan 2004 13:00:22 -0000 1.1 --- source-lines.nice 3 Feb 2004 01:45:51 -0000 1.2 *************** *** 269,273 **** parseLine(section, id); ! if (lineNumber >= outStart && lineNumber <= outStart + repeat * outInc) { // Found it! --- 269,273 ---- parseLine(section, id); ! if (lineNumber >= outStart && lineNumber < outStart + repeat * outInc) { // Found it! |
From: <ar...@us...> - 2004-02-03 01:30:21
|
Update of /cvsroot/nice/Nice/testsuite/compiler/expressions In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv4606/F:/nice/testsuite/compiler/expressions Modified Files: expressionlocalvariable.testsuite Log Message: Fix compilation of multiple exp local vars. Index: expressionlocalvariable.testsuite =================================================================== RCS file: /cvsroot/nice/Nice/testsuite/compiler/expressions/expressionlocalvariable.testsuite,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** expressionlocalvariable.testsuite 2 Feb 2004 23:21:45 -0000 1.1 --- expressionlocalvariable.testsuite 3 Feb 2004 01:28:10 -0000 1.2 *************** *** 37,39 **** /// Toplevel void foo(String x, ()->void func) {} ! \ No newline at end of file --- 37,47 ---- /// Toplevel void foo(String x, ()->void func) {} ! ! /// PASS ! foo(var x = 5, let y = x+3, x*y); ! /// Toplevel ! void foo(int x, int y, int z) { ! assert x == 5; ! assert y == 8; ! assert z == 40; ! } |
From: <ar...@us...> - 2004-02-03 01:30:21
|
Update of /cvsroot/nice/Nice/src/bossa/syntax In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv4606/F:/nice/src/bossa/syntax Modified Files: CallExp.java Log Message: Fix compilation of multiple exp local vars. Index: CallExp.java =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/syntax/CallExp.java,v retrieving revision 1.88 retrieving revision 1.89 diff -C2 -d -r1.88 -r1.89 *** CallExp.java 2 Feb 2004 23:21:44 -0000 1.88 --- CallExp.java 3 Feb 2004 01:28:10 -0000 1.89 *************** *** 325,329 **** gnu.expr.LetExp letExp = new gnu.expr.LetExp(eVal); eVal[0] = localVars[i].variable.compile(letExp); ! if (i == 0) { firstLetExp = letExp; --- 325,329 ---- gnu.expr.LetExp letExp = new gnu.expr.LetExp(eVal); eVal[0] = localVars[i].variable.compile(letExp); ! if (i == localVars.length-1) { firstLetExp = letExp; |
From: <ar...@us...> - 2004-02-03 00:51:31
|
Update of /cvsroot/nice/Nice/src/bossa/parser In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv4491/F:/nice/src/bossa/parser Modified Files: Parser.jj Log Message: Made switch an unused keyword to improve the parse error message. Index: Parser.jj =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/parser/Parser.jj,v retrieving revision 1.235 retrieving revision 1.236 diff -C2 -d -r1.235 -r1.236 *** Parser.jj 2 Feb 2004 23:21:45 -0000 1.235 --- Parser.jj 3 Feb 2004 00:49:23 -0000 1.236 *************** *** 194,197 **** --- 194,200 ---- | < CONTINUE: "continue" > + // switch is an unused keyword to improve error message + | < SWITCH: "switch" > + // Statements | < RETURN: "return" > |
From: <ar...@us...> - 2004-02-02 23:23:55
|
Update of /cvsroot/nice/Nice/src/bossa/syntax In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv29552/F:/nice/src/bossa/syntax Modified Files: analyse.nice typecheck.nice Arguments.java CallExp.java Added Files: ExpLocalVariable.java Log Message: Implemented expression local variables. syntax: '("let"|"var") [type] name = expression' they can be used as argument of some call. example: using(let fileInput = new FileInputStream(somefile)) { ... } --- NEW FILE: ExpLocalVariable.java --- /**************************************************************************/ /* N I C E */ /* A high-level object-oriented research language */ /* (c) Daniel Bonniot 2002 */ /* */ /* This program is free software; you can redistribute it and/or modify */ /* it under the terms of the GNU General Public License as published by */ /* the Free Software Foundation; either version 2 of the License, or */ /* (at your option) any later version. */ /* */ /**************************************************************************/ package bossa.syntax; import java.util.*; import bossa.util.*; import mlsub.typing.Polytype; public class ExpLocalVariable extends Expression { public ExpLocalVariable(LocatedString name, Expression value, boolean constant, Monotype type) { this.variable = new Block.LocalVariable(name, type, constant, null); this.initValue = value; setLocation(name.location()); } void computeType() { this.type = variable.left.getType(); } protected gnu.expr.Expression compile() { return compileAssign(initValue.generateCode()); } gnu.expr.Declaration getDeclaration() { return variable.getSymbol().getDeclaration(); } Block.LocalVariable variable; Expression initValue; } Index: analyse.nice =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/syntax/analyse.nice,v retrieving revision 1.97 retrieving revision 1.98 diff -C2 -d -r1.97 -r1.98 *** analyse.nice 12 Dec 2003 23:20:39 -0000 1.97 --- analyse.nice 2 Feb 2004 23:21:44 -0000 1.98 *************** *** 299,309 **** --- 299,325 ---- } + analyse(e@ExpLocalVariable, info) + { + e.initValue = analyse(e.initValue, info); + setInitialized(notNull(notNull(e.variable).left), info, e.location()); + return e; + } + analyse(e@CallExp, info) { Arguments args = e.arguments; + + let ExpLocalVariable[?] expLocals = e.localVars = cast(args.extractLocalVars()); if (e.infix) markAsCallFirstArg(notNull(args.getExp(0))); + if (expLocals != null) + { + info.begin(); + for (local : expLocals) + analyse(local.variable, info); + } + boolean noEscape = args.size() == 2 && (e.isCallTo("foreach") || e.isCallTo("forbreak") || e.isCallTo("map") || *************** *** 311,314 **** --- 327,333 ---- args.analyse(info, noEscape); + if (expLocals != null) + info.end(); + if (e.infix) { Index: typecheck.nice =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/syntax/typecheck.nice,v retrieving revision 1.95 retrieving revision 1.96 diff -C2 -d -r1.95 -r1.96 *** typecheck.nice 9 Dec 2003 17:20:14 -0000 1.95 --- typecheck.nice 2 Feb 2004 23:21:44 -0000 1.96 *************** *** 654,657 **** --- 654,696 ---- } + typecheck(e@ExpLocalVariable) + { + Block.LocalVariable decl = notNull(e.variable); + MonoSymbol target = notNull(decl.left); + + if (! target.used) + bossa.util.User.warning(decl, "Unused local variable " + target.name); + + ?mlsub.typing.Monotype type = target.getMonotype(); + Expression value = notNull(e.initValue); + + if (type == null) + { + value.typecheck(); + e.initValue = decl.value = value = value.noOverloading(); + target.type = checkMonomorphic(value.getType(), decl); + + if (nice.tools.code.Types.isVoid(target.type)) + throw error(decl, "A variable cannot have a void type"); + } + else + { + try{ + mlsub.typing.Polytype polytype = new mlsub.typing.Polytype(type); + e.initValue = decl.value = value = value.resolveOverloading(polytype); + checkAssignment(polytype, value); + } + catch(TypingEx t){ + reportNullAssignmentError(decl, t, value: value, + target.name.toString(), + target.getMonotype()); + throw assignmentError(target, target.name.toString(), + String.valueOf(target.getMonotype), + value); + } + } + decl.value = null; + } + typecheck(c@ConstantExp){} typecheck(e@NullExp) {} Index: Arguments.java =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/syntax/Arguments.java,v retrieving revision 1.23 retrieving revision 1.24 diff -C2 -d -r1.23 -r1.24 *** Arguments.java 12 Dec 2003 20:34:46 -0000 1.23 --- Arguments.java 2 Feb 2004 23:21:44 -0000 1.24 *************** *** 161,164 **** --- 161,178 ---- } + ExpLocalVariable[] extractLocalVars() + { + List res = new ArrayList(); + + for (int i = arguments.length; --i>=0; ) + if (arguments[i].value instanceof ExpLocalVariable) + res.add(arguments[i].value); + + if (res.isEmpty()) + return null; + + return (ExpLocalVariable[])res.toArray(new ExpLocalVariable[res.size()]); + } + java.util.Map applicationExpressions = new java.util.HashMap(); Index: CallExp.java =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/syntax/CallExp.java,v retrieving revision 1.87 retrieving revision 1.88 diff -C2 -d -r1.87 -r1.88 *** CallExp.java 13 Dec 2003 14:06:00 -0000 1.87 --- CallExp.java 2 Feb 2004 23:21:44 -0000 1.88 *************** *** 316,319 **** --- 316,341 ---- { gnu.expr.Expression res; + gnu.expr.LetExp firstLetExp = null; + gnu.expr.Expression letExpRes = null; + if (localVars != null) + { + for(int i = localVars.length-1; i >= 0; i--) + { + gnu.expr.Expression[] eVal = new gnu.expr.Expression[1]; + gnu.expr.LetExp letExp = new gnu.expr.LetExp(eVal); + eVal[0] = localVars[i].variable.compile(letExp); + if (i == 0) + { + firstLetExp = letExp; + } + else + { + letExp.setBody(letExpRes); + } + + letExpRes = letExp; + } + } + if (function.isFieldAccess()) res = function.getFieldAccessMethod().compileAccess(compileParams()); *************** *** 323,326 **** --- 345,354 ---- location().write(res); + if (firstLetExp != null) + { + firstLetExp.setBody(res); + res = letExpRes; + } + return EnsureTypeProc.ensure(res, Types.javaType(type)); } *************** *** 404,406 **** --- 432,436 ---- /** Class this static method is defined in, or null */ gnu.bytecode.ClassType declaringClass = null; + + ExpLocalVariable[] localVars = null; } |
From: <ar...@us...> - 2004-02-02 23:23:54
|
Update of /cvsroot/nice/Nice/testsuite/compiler/expressions In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv29552/F:/nice/testsuite/compiler/expressions Added Files: expressionlocalvariable.testsuite Log Message: Implemented expression local variables. syntax: '("let"|"var") [type] name = expression' they can be used as argument of some call. example: using(let fileInput = new FileInputStream(somefile)) { ... } --- NEW FILE: expressionlocalvariable.testsuite --- /// PASS foo(let x = "abc") { assert x.equals("abc"); } /// Toplevel void foo(String x, ()->void func) { assert x.equals("abc"); func(); } /// PASS foo(var x = false) { x = true; assert x; } /// Toplevel void foo(boolean x, ()->void func) { assert !x; func(); } /// PASS foo(let List<int> x1 = [1,2], [x1[0], x1[1]]); /// Toplevel void foo(List<int> x1, List<int> x2) { assert x1[0] == 1; assert x1[1] == 2; assert x2[0] == 1; assert x2[1] == 2; } /// FAIL foo(var x = "abc") {} /* ///FAIL HERE */x = "xyz"; /// Toplevel void foo(String x, ()->void func) {} |
From: <ar...@us...> - 2004-02-02 23:23:54
|
Update of /cvsroot/nice/Nice/src/bossa/parser In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv29552/F:/nice/src/bossa/parser Modified Files: Parser.jj Log Message: Implemented expression local variables. syntax: '("let"|"var") [type] name = expression' they can be used as argument of some call. example: using(let fileInput = new FileInputStream(somefile)) { ... } Index: Parser.jj =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/parser/Parser.jj,v retrieving revision 1.234 retrieving revision 1.235 diff -C2 -d -r1.234 -r1.235 *** Parser.jj 27 Jan 2004 22:58:14 -0000 1.234 --- Parser.jj 2 Feb 2004 23:21:45 -0000 1.235 *************** *** 2248,2251 **** --- 2248,2267 ---- } + ExpLocalVariable ExpLocalVariable(): + { + boolean constant = false; + LocatedString name; + Monotype type = null; + Expression value; + } + { + ( "var" | "let" {constant = true;} ) + [LOOKAHEAD(monotype() ident()) type=monotype() ] + name=ident() + "=" + value=Expression() + { return new ExpLocalVariable(name, value, constant, type); } + } + Arguments.Argument argument(): { *************** *** 2254,2259 **** --- 2270,2279 ---- } { + ( [ LOOKAHEAD(ident() ":") id = ident() ":" ] e = Expression() + | + e = ExpLocalVariable() + ) { return new Arguments.Argument(e, id); } } |
From: <xo...@us...> - 2004-02-02 22:42:00
|
Update of /cvsroot/nice/Nice/web In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv27350/web Modified Files: manual.xml Log Message: Added section on declaring interfaces, including default implementations. Updated value dispatch section to cover char, null, enums, and class instances. Mention range objects in passing in the foreach section. Updated multi-line strings with internal quotes. Index: manual.xml =================================================================== RCS file: /cvsroot/nice/Nice/web/manual.xml,v retrieving revision 1.33 retrieving revision 1.34 diff -C2 -d -r1.33 -r1.34 *** manual.xml 24 Jan 2004 21:50:23 -0000 1.33 --- manual.xml 2 Feb 2004 22:39:47 -0000 1.34 *************** *** 137,141 **** </chapter> ! <chapter><title>Classes</title> <section><title>Declaring a class</title> <para> --- 137,141 ---- </chapter> ! <chapter><title>Classes and Interfaces</title> <section><title>Declaring a class</title> <para> *************** *** 306,309 **** --- 306,399 ---- </para> </section> + <section><title>Declaring an Interface</title> + <para> + Nice has single inheritance, like Java or C#, which means that each + class can have at most one superclass which it extends. Sometimes, + it would be nice to have a class that "extends" two (or more) different + classes, taking some of its behavior and data from each. + In Nice, as in Java, this can be accomplished via + <firstterm>interfaces</firstterm>. + </para> + <para> + Interfaces are declared just like classes, except that they may + not contain data fields, only methods. Unlike in Java, they may + also contain default implementations of the methods, making + iterfaces more convenient and useful than Java interfaces. + </para> + <para> + To say even this much is still to think of interfaces in Java terms, + however. In Nice, an interface + doesn't really "contain" anything at all, it's just a marker. + Just as <literal>java.util.Serializable</literal> is just a tag + to tell Java that it's okay to use serialization on instances of + a class, all Nice interfaces are really tags. + </para> + <para> + This is because Nice + has multi-methods, which are defined by themselves and not contained + in a class or interface. It is always possible to define new + methods for an interface, just as it is always possible to define + new methods for a class. Another consequence of the fact Nice is + based on multi-methods is that interface definitions can "contain" + not only method signatures, but also default implementations. + </para> + <para> + Nice does accept a style of interface definition similar to Java's, + as in the following example: + <example> + <title>Declaring an Interface</title> + <programlisting lang="nice"> + interface Component + { + + String getID(); + + (int,int) getPosition(); + + (int,int) getDimensions(); + + int getArea() + { + (int width, int height) = this.getDimensions(); + return width * height; + } + + } + </programlisting> + </example> + </para> + <para> + However, it's equally possible to define the same interface + in this style: + <example> + <title>Declaring an Interface with Multi-Methods</title> + <programlisting lang="nice"> + interface Component {} + + String getID(Component comp); + + (int,int) getPosition(Component comp); + + (int,int) getDimensions(Component comp); + + int getArea(Component comp) + { + (int width, int height) = comp.getDimensions(); + return width * height; + } + </programlisting> + </example> + and in fact, it's fine to mix the two styles, declaring + some of the methods inside the <literal>iterface</literal> + block, and some outside. One good practice might be to + declare those methods which have no default implementation + inside the <literal>interface</literal> block, and those + with default implementations outside of it. That way someone + reading the code will have a clear idea of which methods + must be implemented when implementing an interface. Of + course, the compiler will ensure that all necessary methods + are implemented, so this is only a suggestion. + </para> + </section> </chapter> *************** *** 506,510 **** arguments, it's even possible to override a method based on the actual values of the arguments. Currently this feature works ! with integers, booleans, and strings. This feature makes it convenient to code things that might otherwise have required switch statements or nested if/else statements. Using value --- 596,606 ---- arguments, it's even possible to override a method based on the actual values of the arguments. Currently this feature works ! with integers, booleans, strings, characters, enums, and ! class instances which are used as package level constants. ! It is also possible to override a method for the special case ! of null. ! </para> ! <para> ! This feature makes it convenient to code things that might otherwise have required switch statements or nested if/else statements. Using value *************** *** 533,536 **** --- 629,676 ---- booleanToYesNo(true) = "yes"; booleanToYesNo(false) = "no"; + + enum Grade { + A, B, C, D, F + } + + Grade charToGrade(char input); + + charToGrade('a') = A; + charToGrade('b') = B; + charToGrade('c') = C; + charToGrade('d') = D; + charToGrade('f') = F; + charToGrade(input) { + throw new IllegalArgumentException("Not a grade letter: " + input); + } + + char gradeToChar(Grade grade); + gradeToChar(A) = 'a'; + gradeToChar(B) = 'b'; + gradeToChar(C) = 'c'; + gradeToChar(D) = 'd'; + gradeToChar(F) = 'f'; + + class Person + { + } + + let Person BOB = new Person(); + + void greet(Person p) + { + println("Hello, anonymous person!"); + } + + greet(BOB p) + { + println("Hi Bob!"); + } + + <T> int containsHowMany(?List<T> list); + + <T> containsHowMany(list) = list.notNull.size(); + containsHowMany(null) = 0; + ]]></programlisting> </example> *************** *** 757,760 **** --- 897,901 ---- Currently, this version of the <literal>for</literal> statement can be used to iterate over <literal>Collection</literal>s, arrays, + <literal>Range</literal>s, <literal>String</literal>s, and <literal>StringBuffer</literal>s. </para> *************** *** 770,773 **** --- 911,928 ---- </example> </para> + <para> + Since Nice also has syntax for generating ranges of numbers, + another convenient way to use the <literal>for</literal> statement + is as follows: + <example><title>Extended <literal>for</literal> with Ranges</title> + <programlisting lang="nice"> + //Print numbers from 1 to 10, inclusive + for(int i : 1..10) + { + println(i); + } + </programlisting> + </example> + </para> </section> <section id="localMethods"><title>Local methods</title> *************** *** 961,972 **** Nice also allows multi-line string literals, using syntax borrowed from the Python language. Multi-line strings begin and end with ! three double quotes. ! <!-- ! This is how it _should_ work, IMHO: ! Within multi-line strings, double quotes do not need to be escaped, unless there are three in a row. - --> Note that unlike in Python, it is still necessary to use - a backslash before double quotes that should be included in the - string. </para> <example> --- 1116,1121 ---- Nice also allows multi-line string literals, using syntax borrowed from the Python language. Multi-line strings begin and end with ! three double quotes. Within multi-line strings, double quotes do not need to be escaped, unless there are three in a row. </para> <example> *************** *** 975,979 **** let greeting = """ Hello, world. ! You may be thinking, \"Why was I called here today?\" Well, there was a good reason. Honest. """; --- 1124,1128 ---- let greeting = """ Hello, world. ! You may be thinking, "Why was I called here today?" Well, there was a good reason. Honest. """; |
From: <bo...@us...> - 2004-02-02 19:23:18
|
Update of /cvsroot/nice/Nice/src/bossa/syntax In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv18682/src/bossa/syntax Modified Files: FormalParameters.java Log Message: Allow to get debuging information about bytecode attributes. Index: FormalParameters.java =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/syntax/FormalParameters.java,v retrieving revision 1.35 retrieving revision 1.36 diff -C2 -d -r1.35 -r1.36 *** FormalParameters.java 22 Dec 2003 01:30:59 -0000 1.35 --- FormalParameters.java 2 Feb 2004 19:21:12 -0000 1.36 *************** *** 565,568 **** --- 565,573 ---- { String value = new String(attr.data); + + if (Debug.bytecodeAttributes) + Debug.println("Read attribute " + attr.getName() + "=\"" + value + + "\" from " + attr.getContainer()); + try { return |
From: <bo...@us...> - 2004-02-02 19:23:17
|
Update of /cvsroot/nice/Nice/src/bossa/util In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv18682/src/bossa/util Modified Files: Debug.java Log Message: Allow to get debuging information about bytecode attributes. Index: Debug.java =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/util/Debug.java,v retrieving revision 1.17 retrieving revision 1.18 diff -C2 -d -r1.17 -r1.18 *** Debug.java 24 Jul 2003 15:05:54 -0000 1.17 --- Debug.java 2 Feb 2004 19:21:11 -0000 1.18 *************** *** 83,86 **** --- 83,87 ---- overloading = getBoolean("debug.overloading",false), powerUser = getBoolean("debug.powerUser",false), + bytecodeAttributes = getBoolean("debug.bytecodeAttributes",false), codeGeneration = getBoolean("debug.codeGeneration",false), javaTypes = getBoolean("debug.javaTypes",false), |
From: <bo...@us...> - 2004-02-02 19:21:56
|
Update of /cvsroot/nice/Nice/src/gnu/bytecode In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv17323/src/gnu/bytecode Modified Files: ClassFileInput.java Log Message: Correctly set attributes' container info. Index: ClassFileInput.java =================================================================== RCS file: /cvsroot/nice/Nice/src/gnu/bytecode/ClassFileInput.java,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** ClassFileInput.java 27 Nov 2003 00:54:43 -0000 1.6 --- ClassFileInput.java 2 Feb 2004 19:19:50 -0000 1.7 *************** *** 160,163 **** --- 160,164 ---- if (attr != null) { + attr.setContainer(container); if (attr.getNameIndex() == 0) attr.setNameIndex(index); |
From: <bo...@us...> - 2004-02-02 19:04:33
|
Update of /cvsroot/nice/Nice/src/bossa/syntax In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv2511 Modified Files: UserOperator.java Log Message: Make toString more robust. Index: UserOperator.java =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/syntax/UserOperator.java,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** UserOperator.java 13 Dec 2003 14:54:08 -0000 1.7 --- UserOperator.java 2 Feb 2004 19:02:28 -0000 1.8 *************** *** 83,87 **** public String toString() { ! return super.toString() + contract.toString(); } --- 83,87 ---- public String toString() { ! return super.toString() + String.valueOf(contract); } |
From: <bo...@pr...> - 2004-02-02 17:27:32
|
Update of /cvsroot/nice/Nice/src/mlsub/typing In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv15988/src/mlsub/typing Modified Files: Polytype.java Log Message: Make toString more robuts, which is especially important for debuging. Index: Polytype.java =================================================================== RCS file: /cvsroot/nice/Nice/src/mlsub/typing/Polytype.java,v retrieving revision 1.20 retrieving revision 1.21 diff -C2 -d -r1.20 -r1.21 *** Polytype.java 8 Dec 2003 19:43:21 -0000 1.20 --- Polytype.java 2 Feb 2004 17:25:26 -0000 1.21 *************** *** 333,342 **** } ! return Constraint.toString(constraint) + monotype.toString(); } public String toStringNoSimplify() { ! return Constraint.toString(constraint) + monotype.toString(); } --- 333,342 ---- } ! return Constraint.toString(constraint) + String.valueOf(monotype); } public String toStringNoSimplify() { ! return Constraint.toString(constraint) + String.valueOf(monotype); } |
From: <bo...@pr...> - 2004-02-02 13:10:37
|
Update of /cvsroot/nice/Nice/src/bossa/syntax In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv27438/src/bossa/syntax Modified Files: Pattern.java Log Message: Perform exact matching on the first argument of methods declared in Java when needed (fixes #888229). Index: Pattern.java =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/syntax/Pattern.java,v retrieving revision 1.77 retrieving revision 1.78 diff -C2 -d -r1.77 -r1.78 *** Pattern.java 23 Dec 2003 11:30:58 -0000 1.77 --- Pattern.java 2 Feb 2004 13:08:33 -0000 1.78 *************** *** 769,781 **** /** Returns code that tests if the parameter is matched. */ ! public gnu.expr.Expression matchTest(gnu.expr.Expression parameter) { if (atNull()) return Gen.isNullExp(parameter); - if (atAny()) - return QuoteExp.trueExp; - if (atBool()) { --- 769,785 ---- /** Returns code that tests if the parameter is matched. + + @param dispatchMade indicates that dispatch has already occured. It is + still necessary to check for exact matching if applicable. */ ! public gnu.expr.Expression matchTest(gnu.expr.Expression parameter, ! boolean dispatchMade) { + if (atAny() || (dispatchMade && ! exactlyAt)) + return QuoteExp.trueExp; + if (atNull()) return Gen.isNullExp(parameter); if (atBool()) { |