nice-commit Mailing List for The Nice Programming Language (Page 101)
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...> - 2003-06-15 11:07:48
|
Update of /cvsroot/nice/Nice/src/bossa/modules In directory sc8-pr-cvs1:/tmp/cvs-serv12114/src/bossa/modules Modified Files: CompilationListener.java Compilation.nice Log Message: Changed the range of progress value to 0..1 instead of 0..100 Index: CompilationListener.java =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/modules/CompilationListener.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** CompilationListener.java 15 Jun 2003 10:55:33 -0000 1.1 --- CompilationListener.java 15 Jun 2003 11:07:45 -0000 1.2 *************** *** 16,20 **** The listener interface for compilation events. ! @author (bo...@us...) */ --- 16,20 ---- The listener interface for compilation events. ! @author Daniel Bonniot (bo...@us...) */ *************** *** 40,44 **** /** Gives an approximation of how much of the compilation has been completed. */ ! void progress(float percent); } --- 40,46 ---- /** Gives an approximation of how much of the compilation has been completed. + @param proportion the current progress + (0.0 = just started, 1.0 = complete). */ ! void progress(float proportion); } Index: Compilation.nice =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/modules/Compilation.nice,v retrieving revision 1.23 retrieving revision 1.24 diff -C2 -d -r1.23 -r1.24 *** Compilation.nice 14 Jun 2003 14:20:38 -0000 1.23 --- Compilation.nice 15 Jun 2003 11:07:45 -0000 1.24 *************** *** 137,141 **** { totalProgress += weight / totalNumberOfDeclarations; ! listener.progress(totalProgress * 100); } } --- 137,141 ---- { totalProgress += weight / totalNumberOfDeclarations; ! listener.progress(totalProgress); } } |
From: <bo...@us...> - 2003-06-15 10:55:36
|
Update of /cvsroot/nice/Nice/src/bossa/modules In directory sc8-pr-cvs1:/tmp/cvs-serv10986/src/bossa/modules Added Files: CompilationListener.java Log Message: Switched CompilationListener to a Java source, so it can be implemented by a Java class. --- NEW FILE: CompilationListener.java --- /**************************************************************************/ /* N I C E */ /* A high-level object-oriented research language */ /* (c) Daniel Bonniot 2003 */ /* */ /* 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.modules; /** The listener interface for compilation events. @author (bo...@us...) */ import bossa.util.*; public interface CompilationListener { void error (Location location, String message); void warning(Location location, String message); /** A bug occured in the compiler. @param url the adress where a bug report should be submitted. */ void bug(String stackTrace, String url); /** Reports the progress of compilation. phase can be: parsing, type-checking, generating code, ... the package can be null if the phase applies to the whole program (testing dispatch, creating the archive, compiling to native code, ...). */ void progress(String packageName, String phase); /** Gives an approximation of how much of the compilation has been completed. */ void progress(float percent); } |
From: <bo...@us...> - 2003-06-15 10:54:47
|
Update of /cvsroot/nice/Nice/src/bossa/modules In directory sc8-pr-cvs1:/tmp/cvs-serv10904/src/bossa/modules Removed Files: CompilationListener.nice Log Message: Switched CompilationListener to a Java source, so it can be implemented by a Java class. --- CompilationListener.nice DELETED --- |
From: <bo...@us...> - 2003-06-15 10:54:47
|
Update of /cvsroot/nice/Nice/src/nice/tools/compiler In directory sc8-pr-cvs1:/tmp/cvs-serv10904/src/nice/tools/compiler Modified Files: interface.nice Log Message: Switched CompilationListener to a Java source, so it can be implemented by a Java class. Index: interface.nice =================================================================== RCS file: /cvsroot/nice/Nice/src/nice/tools/compiler/interface.nice,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** interface.nice 11 Jun 2003 22:24:06 -0000 1.5 --- interface.nice 15 Jun 2003 10:54:44 -0000 1.6 *************** *** 65,70 **** compilation.listener.bug ! (stackTrace: stackTrace.toString(), ! url: "http://sourceforge.net/tracker/?func=add&group_id=12788&atid=112788" ); --- 65,70 ---- compilation.listener.bug ! (/*stackTrace:*/ stackTrace.toString(), ! /*url:*/ "http://sourceforge.net/tracker/?func=add&group_id=12788&atid=112788" ); |
From: <ar...@us...> - 2003-06-15 10:01:46
|
Update of /cvsroot/nice/Nice/src/bossa/syntax In directory sc8-pr-cvs1:/tmp/cvs-serv5761/F:/nice/src/bossa/syntax Modified Files: MethodBodyDefinition.java Log Message: Improve some details of overloading resolving using additional tags. Index: MethodBodyDefinition.java =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/syntax/MethodBodyDefinition.java,v retrieving revision 1.127 retrieving revision 1.128 diff -C2 -d -r1.127 -r1.128 *** MethodBodyDefinition.java 14 Jun 2003 23:39:37 -0000 1.127 --- MethodBodyDefinition.java 15 Jun 2003 10:01:43 -0000 1.128 *************** *** 223,226 **** --- 223,227 ---- /* If the method are ambigious and the implementation has additional tc's * then try to find the most specific declaration(s) using these tc's + * TODO: combine this code with removeNonMinimal in OverloadedSymbolExp */ if (symbols.size() > 1 && hasAdditionalTags) *************** *** 238,242 **** { boolean remove = true; ! boolean equal = true; Monotype[] dom2 = tempSymbols[m2].getDefinition().getType().domain(); for (int i = 0; i < len && remove; i++) --- 239,243 ---- { boolean remove = true; ! boolean additionalsEqual = true; Monotype[] dom2 = tempSymbols[m2].getDefinition().getType().domain(); for (int i = 0; i < len && remove; i++) *************** *** 248,264 **** } catch (TypingEx e) { ! // may not remove if an argument without ! // additional tc is not equal. ! remove = additionalTags[i] != null; ! equal = false; } } catch(TypingEx e) { ! remove = false; ! equal = false; } } ! // don't remove identical methods. ! removed[m1] = remove && !equal; } } --- 249,263 ---- } catch (TypingEx e) { ! if (additionalTags[i] != null) ! additionalsEqual = false; } } catch(TypingEx e) { ! //ignore arguments with additional. ! remove = additionalTags[i] == null; } } ! //may not remove a method that is equal for the arguments with an additional. ! removed[m1] = remove && !additionalsEqual; } } |
From: <ar...@us...> - 2003-06-15 10:01:46
|
Update of /cvsroot/nice/Nice/testsuite/compiler/overloading In directory sc8-pr-cvs1:/tmp/cvs-serv5761/F:/nice/testsuite/compiler/overloading Modified Files: specificity.testsuite Log Message: Improve some details of overloading resolving using additional tags. Index: specificity.testsuite =================================================================== RCS file: /cvsroot/nice/Nice/testsuite/compiler/overloading/specificity.testsuite,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** specificity.testsuite 14 Jun 2003 23:39:38 -0000 1.2 --- specificity.testsuite 15 Jun 2003 10:01:43 -0000 1.3 *************** *** 59,73 **** class B extends A {} void foo(A, String); - void foo(B, String); - foo(@B(A), s) {} - foo(@B(B), s) {} - - /// FAIL - /// Toplevel - abstract class A {} - class B extends A {} - void foo(A, String); void foo(B ,Number); - //still ambigious for the second argument foo(@B(A) ,s) {} foo(@B(B) ,s) {} --- 59,63 ---- *************** *** 94,95 **** --- 84,104 ---- foo(@B(A)) {} foo(@B(B)) {} + + /// FAIL + /// Toplevel + abstract class A {} + class B extends A {} + void foo(A, String); + void foo(B ,Number); + void foo(B ,Integer); + foo(@B(A) ,s) {} + foo(@B(B) ,s) {} + + /// PASS + /// Toplevel + abstract class A {} + class B extends A {} + void foo(A, B); + void foo(B ,A); + foo(@B(A) ,x) {} + foo(@B(B) ,x) {} |
From: <ar...@us...> - 2003-06-14 23:39:40
|
Update of /cvsroot/nice/Nice/testsuite/compiler/overloading In directory sc8-pr-cvs1:/tmp/cvs-serv14351/F:/nice/testsuite/compiler/overloading Modified Files: specificity.testsuite Log Message: If a method is ambigious and has an additional tc then find the most specific match for that method. Index: specificity.testsuite =================================================================== RCS file: /cvsroot/nice/Nice/testsuite/compiler/overloading/specificity.testsuite,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** specificity.testsuite 25 Sep 2002 16:40:07 -0000 1.1 --- specificity.testsuite 14 Jun 2003 23:39:38 -0000 1.2 *************** *** 45,46 **** --- 45,95 ---- void f(B a, String s, int i = 0) { } + /// PASS + /// Toplevel + abstract class A {} + class B extends A {} + void foo(A); + void foo(B); + foo(@B(A)) {} + foo(@B(B)) {} + + /// PASS + /// Toplevel + abstract class A {} + class B extends A {} + void foo(A, String); + void foo(B, String); + foo(@B(A), s) {} + foo(@B(B), s) {} + + /// FAIL + /// Toplevel + abstract class A {} + class B extends A {} + void foo(A, String); + void foo(B ,Number); + //still ambigious for the second argument + foo(@B(A) ,s) {} + foo(@B(B) ,s) {} + + /// PASS + /// Toplevel + abstract class A {} + class B extends A {} + void foo(A, A); + void foo(A, B); + void foo(B, A); + void foo(B, B); + foo(@B(A) ,@B(A)) {} + foo(@B(A) ,@B(B)) {} + foo(@B(B) ,@B(A)) {} + foo(@B(B) ,@B(B)) {} + + /// FAIL + /// Toplevel + abstract class A {} + class B extends A {} + void foo(A); + void foo(A); + foo(@B(A)) {} + foo(@B(B)) {} |
From: <ar...@us...> - 2003-06-14 23:39:40
|
Update of /cvsroot/nice/Nice/src/bossa/syntax In directory sc8-pr-cvs1:/tmp/cvs-serv14351/F:/nice/src/bossa/syntax Modified Files: MethodBodyDefinition.java Log Message: If a method is ambigious and has an additional tc then find the most specific match for that method. Index: MethodBodyDefinition.java =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/syntax/MethodBodyDefinition.java,v retrieving revision 1.126 retrieving revision 1.127 diff -C2 -d -r1.126 -r1.127 *** MethodBodyDefinition.java 12 Jun 2003 16:46:51 -0000 1.126 --- MethodBodyDefinition.java 14 Jun 2003 23:39:37 -0000 1.127 *************** *** 170,174 **** TypeConstructor[] tags = Pattern.getTC(formals); TypeConstructor[] additionalTags = Pattern.getAdditionalTC(formals); ! for(Iterator i = symbols.iterator(); i.hasNext();){ VarSymbol s = (VarSymbol)i.next(); --- 170,178 ---- TypeConstructor[] tags = Pattern.getTC(formals); TypeConstructor[] additionalTags = Pattern.getAdditionalTC(formals); ! boolean hasAdditionalTags = false; ! for (int i = 0; i<tags.length; i++) ! if (additionalTags[i] != null) ! hasAdditionalTags = true; ! for(Iterator i = symbols.iterator(); i.hasNext();){ VarSymbol s = (VarSymbol)i.next(); *************** *** 200,204 **** Constraint.enter(t.getConstraint()); tagLeq(tags, t.domain()); ! tagLeq(additionalTags, t.domain()); } finally{ --- 204,209 ---- Constraint.enter(t.getConstraint()); tagLeq(tags, t.domain()); ! if (hasAdditionalTags) //optimization ! tagLeq(additionalTags, t.domain()); } finally{ *************** *** 216,219 **** --- 221,273 ---- } + /* If the method are ambigious and the implementation has additional tc's + * then try to find the most specific declaration(s) using these tc's + */ + if (symbols.size() > 1 && hasAdditionalTags) + { + MethodDeclaration.Symbol[] tempSymbols = new MethodDeclaration.Symbol[symbols.size()]; + symbols.toArray(tempSymbols); + int size = symbols.size(); + int len = formals.length; + boolean[] removed = new boolean[size]; + for (int m1 = 0; m1 < size; m1++) + { + Monotype[] dom1 = tempSymbols[m1].getDefinition().getType().domain(); + for (int m2 = 0; m2 < size && !removed[m1]; m2++) + if (m1 != m2) + { + boolean remove = true; + boolean equal = true; + Monotype[] dom2 = tempSymbols[m2].getDefinition().getType().domain(); + for (int i = 0; i < len && remove; i++) + { + try { + domainMonotypeLeq(dom2[i], dom1[i]); + try { + domainMonotypeLeq(dom1[i], dom2[i]); + } + catch (TypingEx e) { + // may not remove if an argument without + // additional tc is not equal. + remove = additionalTags[i] != null; + equal = false; + } + } + catch(TypingEx e) { + remove = false; + equal = false; + } + } + // don't remove identical methods. + removed[m1] = remove && !equal; + } + } + + symbols = new LinkedList(); + for (int i = 0; i < size; i++) + if (!removed[i]) + symbols.add(tempSymbols[i]); + } + if(symbols.size() == 1) return (VarSymbol) symbols.get(0); *************** *** 253,256 **** --- 307,320 ---- } + private void domainMonotypeLeq(Monotype m1, Monotype m2) throws TypingEx + { + if (m1 == m2) + return; + + Types.setMarkedKind(m1); + Types.setMarkedKind(m2); + Typing.leq(((MonotypeConstructor) m1.equivalent()).getTP()[0], + ((MonotypeConstructor) m2.equivalent()).getTP()[0]); + } void doResolve() { |
From: <ar...@us...> - 2003-06-14 17:43:48
|
Update of /cvsroot/nice/Nice/testsuite/compiler/methods In directory sc8-pr-cvs1:/tmp/cvs-serv2218/F:/nice/testsuite/compiler/methods Modified Files: integer.testsuite Log Message: The variable=value and variable=constant patterns are not a valid syntax. Index: integer.testsuite =================================================================== RCS file: /cvsroot/nice/Nice/testsuite/compiler/methods/integer.testsuite,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** integer.testsuite 14 Jun 2003 16:21:26 -0000 1.6 --- integer.testsuite 14 Jun 2003 17:43:45 -0000 1.7 *************** *** 63,68 **** int fib(int n); fib(n) = fib(n-2) + fib(n-1); ! fib(n=1) = 1; ! fib(n=2) = 1; /// PASS --- 63,68 ---- int fib(int n); fib(n) = fib(n-2) + fib(n-1); ! fib(1) = 1; ! fib(2) = 1; /// PASS *************** *** 70,75 **** String toStr(char); toStr(c@char) = ""; ! toStr(c='a') = "a"; ! toStr(c='b') = "b"; /// FAIL --- 70,75 ---- String toStr(char); toStr(c@char) = ""; ! toStr('a') = "a"; ! toStr('b') = "b"; /// FAIL |
From: <ar...@us...> - 2003-06-14 17:43:48
|
Update of /cvsroot/nice/Nice/src/bossa/parser In directory sc8-pr-cvs1:/tmp/cvs-serv2218/F:/nice/src/bossa/parser Modified Files: Parser.jj Log Message: The variable=value and variable=constant patterns are not a valid syntax. Index: Parser.jj =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/parser/Parser.jj,v retrieving revision 1.184 retrieving revision 1.185 diff -C2 -d -r1.184 -r1.185 *** Parser.jj 14 Jun 2003 16:21:26 -0000 1.184 --- Parser.jj 14 Jun 2003 17:43:45 -0000 1.185 *************** *** 1236,1246 **** t ="#" tc=typeIdent() { exactlyAt = true; } | - t="=" - ( - val=patternLiteral() {loc = val.location(); } - | - refName=ident() {loc = refName.location(); } - ) - | {} //name only ) --- 1236,1239 ---- |
From: <ar...@us...> - 2003-06-14 16:21:29
|
Update of /cvsroot/nice/Nice/testsuite/compiler/methods In directory sc8-pr-cvs1:/tmp/cvs-serv19868/F:/nice/testsuite/compiler/methods Modified Files: globalconstant.testsuite integer.testsuite Log Message: Make dispatch on references work across packages. Changed syntax for value patterns: added =value, variable=value, =constant, variable=constant deprecated variable@value removed @null patterns Index: globalconstant.testsuite =================================================================== RCS file: /cvsroot/nice/Nice/testsuite/compiler/methods/globalconstant.testsuite,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** globalconstant.testsuite 12 Jun 2003 21:04:41 -0000 1.2 --- globalconstant.testsuite 14 Jun 2003 16:21:26 -0000 1.3 *************** *** 5,10 **** int fib(int n); fib(n@int) = fib(n-2) + fib(n-1); ! fib(ONE) = 1; ! fib(TWO) = 1; /// PASS --- 5,10 ---- int fib(int n); fib(n@int) = fib(n-2) + fib(n-1); ! fib(=ONE) = 1; ! fib(=TWO) = 1; /// PASS *************** *** 15,20 **** boolean foo(String); foo(s) = false; ! foo(abc) = true; ! foo(xyz) = false; /// FAIL --- 15,20 ---- boolean foo(String); foo(s) = false; ! foo(=abc) = true; ! foo(=xyz) = false; /// FAIL *************** *** 23,27 **** void foo(int); foo(n) {} ! foo(xxx) {} foo(10) {} --- 23,27 ---- void foo(int); foo(n) {} ! foo(=xxx) {} foo(10) {} *************** *** 31,35 **** void foo(int); foo(n) {} ! foo(xxx) {} /// PASS --- 31,35 ---- void foo(int); foo(n) {} ! foo(=xxx) {} /// PASS *************** *** 42,46 **** boolean foo(String); foo(s) = false; ! foo(abc) = true; /// PASS --- 42,46 ---- boolean foo(String); foo(s) = false; ! foo(=abc) = true; /// PASS *************** *** 52,59 **** boolean foo(A); foo(a) = false; ! foo(xxx) = true; ! foo(yyy) = false; ! /// PASS bug /// package a /// Toplevel --- 52,59 ---- boolean foo(A); foo(a) = false; ! foo(=xxx) = true; ! foo(=yyy) = false; ! /// PASS /// package a /// Toplevel *************** *** 63,68 **** boolean foo(A); foo(a) = false; ! foo(xxx) = true; ! foo(yyy) = false; /// package b import a assert(foo(xxx)); --- 63,68 ---- boolean foo(A); foo(a) = false; ! foo(=xxx) = true; ! foo(=yyy) = false; /// package b import a assert(foo(xxx)); *************** *** 74,77 **** void foo(A); foo(a) {} ! foo(xxx) {} ! foo(xxx) {} --- 74,94 ---- void foo(A); foo(a) {} ! foo(=xxx) {} ! foo(=xxx) {} ! ! /// PASS ! /// package a ! /// Toplevel ! class Color {} ! let Color red = new Color(); ! let Color blue = new Color(); ! let Color green = new Color(); ! String string(Color); ! string(color) = "unknown color"; ! string(=red) = "red"; ! string(=blue) = "blue"; ! string(=green) = "green"; ! /// package b import a ! assert red.string().equals("red"); ! assert blue.string().equals("blue"); ! assert green.string().equals("green"); Index: integer.testsuite =================================================================== RCS file: /cvsroot/nice/Nice/testsuite/compiler/methods/integer.testsuite,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** integer.testsuite 27 Apr 2003 14:26:26 -0000 1.5 --- integer.testsuite 14 Jun 2003 16:21:26 -0000 1.6 *************** *** 47,51 **** void foo(char); foo(@char) {} ! foo('a') {} /// package b import a --- 47,51 ---- void foo(char); foo(@char) {} ! foo(='a') {} /// package b import a *************** *** 63,68 **** int fib(int n); fib(n) = fib(n-2) + fib(n-1); ! fib(n@1) = 1; ! fib(n@2) = 1; /// PASS --- 63,68 ---- int fib(int n); fib(n) = fib(n-2) + fib(n-1); ! fib(n=1) = 1; ! fib(n=2) = 1; /// PASS *************** *** 70,75 **** String toStr(char); toStr(c@char) = ""; ! toStr(c@'a') = "a"; ! toStr(c@'b') = "b"; /// FAIL --- 70,75 ---- String toStr(char); toStr(c@char) = ""; ! toStr(c='a') = "a"; ! toStr(c='b') = "b"; /// FAIL *************** *** 88,93 **** /// Toplevel String getStr(int i, String str); ! getStr(0, str@String) = "no "+str; ! getStr(1, str@String) = "one "+str; ! getStr(2, str@String) = "many "+str; getStr(i, str@String) = "unknown code"; --- 88,93 ---- /// Toplevel String getStr(int i, String str); ! getStr(=0, str@String) = "no "+str; ! getStr(=1, str@String) = "one "+str; ! getStr(=2, str@String) = "many "+str; getStr(i, str@String) = "unknown code"; |
From: <ar...@us...> - 2003-06-14 16:21:28
|
Update of /cvsroot/nice/Nice/src/bossa/syntax In directory sc8-pr-cvs1:/tmp/cvs-serv19868/F:/nice/src/bossa/syntax Modified Files: Pattern.java Log Message: Make dispatch on references work across packages. Changed syntax for value patterns: added =value, variable=value, =constant, variable=constant deprecated variable@value removed @null patterns Index: Pattern.java =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/syntax/Pattern.java,v retrieving revision 1.54 retrieving revision 1.55 diff -C2 -d -r1.54 -r1.55 *** Pattern.java 12 Jun 2003 21:04:41 -0000 1.54 --- Pattern.java 14 Jun 2003 16:21:26 -0000 1.55 *************** *** 49,53 **** the argument's runtime class. */ ! public Pattern(LocatedString name, TypeIdent tc, ConstantExp atValue, boolean exactlyAt, TypeIdent additional, --- 49,53 ---- the argument's runtime class. */ ! public Pattern(LocatedString name, LocatedString refName, TypeIdent tc, ConstantExp atValue, boolean exactlyAt, TypeIdent additional, *************** *** 56,59 **** --- 56,60 ---- { this.name = name; + this.refName = refName; this.typeConstructor = tc; this.additional = additional; *************** *** 75,79 **** Pattern(LocatedString name, TypeIdent tc) { ! this(name, tc, null, false, null, null, name.location()); } --- 76,80 ---- Pattern(LocatedString name, TypeIdent tc) { ! this(name, null, tc, null, false, null, null, name.location()); } *************** *** 86,93 **** Pattern(ConstantExp atValue) { ! this(null, null, atValue, false, null, null, atValue!=null ? atValue.location() : Location.nowhere() ); } final TypeConstructor getRuntimeTC() --- 87,98 ---- Pattern(ConstantExp atValue) { ! this(null, null, null, atValue, false, null, null, atValue!=null ? atValue.location() : Location.nowhere() ); } + Pattern(LocatedString refName) + { + this(null, refName, null, null, false, null, null, refName.location()); + } final TypeConstructor getRuntimeTC() *************** *** 129,174 **** void resolveGlobalConstants(VarScope scope, TypeScope typeScope) { ! if (name != null && tc == null & typeConstructor == null) ! { ! GlobalVarDeclaration.GlobalVarSymbol symbol = null; ! for (Iterator it = scope.lookup(name).iterator(); it.hasNext();) ! { ! Object sym = it.next(); ! if (sym instanceof GlobalVarDeclaration.GlobalVarSymbol) ! symbol = (GlobalVarDeclaration.GlobalVarSymbol)sym; ! } ! if (symbol != null && symbol.constant ) ! { ! if (symbol.getValue() instanceof ConstantExp) ! { ! ConstantExp val = (ConstantExp)symbol.getValue(); ! if (val.tc == PrimitiveType.floatTC) ! return; ! if (val instanceof StringConstantExp) ! typeConstructor = new TypeIdent( ! new LocatedString("java.lang.String", location)); ! tc = val.tc; ! name = null; ! atValue = val; ! } ! else if (symbol.getValue() instanceof NewExp) ! { ! NewExp val = (NewExp)symbol.getValue(); ! symbol.getDefinition().resolve(); ! if (val.tc != null) ! { ! tc = val.tc; ! atValue = new ConstantExp(null, tc, symbol, ! name.toString(), location); ! name = null; ! } ! } ! } ! } } --- 134,180 ---- void resolveGlobalConstants(VarScope scope, TypeScope typeScope) { ! if (refName == null) ! return; ! GlobalVarDeclaration.GlobalVarSymbol symbol = null; ! for (Iterator it = scope.lookup(refName).iterator(); it.hasNext();) ! { ! Object sym = it.next(); ! if (sym instanceof GlobalVarDeclaration.GlobalVarSymbol) ! symbol = (GlobalVarDeclaration.GlobalVarSymbol)sym; ! } ! ! if (symbol == null || !symbol.constant) ! User.error(refName, "" + refName + " is not declared as global constant"); ! if (symbol.getValue() instanceof ConstantExp) ! { ! ConstantExp val = (ConstantExp)symbol.getValue(); ! if (val.tc == PrimitiveType.floatTC) ! return; ! if (val instanceof StringConstantExp) ! typeConstructor = new TypeIdent(new LocatedString("java.lang.String", ! location)); ! tc = val.tc; ! atValue = val; ! } ! else if (symbol.getValue() instanceof NewExp) ! { ! NewExp val = (NewExp)symbol.getValue(); ! symbol.getDefinition().resolve(); ! if (val.tc != null) ! { ! tc = val.tc; ! atValue = new ConstantExp(null, tc, symbol, ! refName.toString(), location); ! } ! else ! Internal.error("can't find tc of globalvarsymbol of "+refName); ! } ! else ! User.error(refName, "The value of " + refName + "can't be used as pattern"); } *************** *** 413,418 **** return "@" + (atValue.longValue() >= 0 ? "+" : "") + atValue; ! if (atValue.value instanceof VarSymbol) ! return "@=" + atValue; return "@" + atValue; --- 419,424 ---- return "@" + (atValue.longValue() >= 0 ? "+" : "") + atValue; ! if (atReference()) ! return "@=" + refName; return "@" + atValue; *************** *** 470,479 **** if (name.charAt(0) == '=') ! return new Pattern(new LocatedString(name.substring(1), ! Location.nowhere()), null); } if (name.equals("_")) ! return new Pattern(null); if (name.equals("NULL")) --- 476,506 ---- if (name.charAt(0) == '=') ! { ! LocatedString refName = new LocatedString(name.substring(1), ! Location.nowhere()); ! GlobalVarDeclaration.GlobalVarSymbol symbol = null; ! for (Iterator it = Node.getGlobalScope().lookup(refName).iterator(); it.hasNext();) ! { ! Object sym = it.next(); ! if (sym instanceof GlobalVarDeclaration.GlobalVarSymbol) ! symbol = (GlobalVarDeclaration.GlobalVarSymbol)sym; ! } ! ! if (symbol == null) ! Internal.error("can't find globalvarsymbol of "+refName); ! ! NewExp val = (NewExp)symbol.getValue(); ! ! symbol.getDefinition().resolve(); ! if (val.tc != null) ! return new Pattern(new ConstantExp(null, val.tc, symbol, ! refName.toString(), refName.location())); ! else ! Internal.error("can't find tc of globalvarsymbol of "+refName); ! } } if (name.equals("_")) ! return new Pattern((ConstantExp)null); if (name.equals("NULL")) *************** *** 536,540 **** ****************************************************************/ ! LocatedString name; TypeIdent typeConstructor, additional; public TypeConstructor tc; --- 563,567 ---- ****************************************************************/ ! LocatedString name, refName; TypeIdent typeConstructor, additional; public TypeConstructor tc; *************** *** 567,573 **** public boolean atFalse() { return atValue != null && atValue.isFalse(); } public boolean atString() { return atValue instanceof StringConstantExp; } ! public boolean atReference() ! { ! return atValue != null && atValue.value instanceof VarSymbol; ! } } --- 594,597 ---- public boolean atFalse() { return atValue != null && atValue.isFalse(); } public boolean atString() { return atValue instanceof StringConstantExp; } ! public boolean atReference() { return atValue != null && atValue.value instanceof VarSymbol; } } |
From: <ar...@us...> - 2003-06-14 16:21:28
|
Update of /cvsroot/nice/Nice/src/bossa/parser In directory sc8-pr-cvs1:/tmp/cvs-serv19868/F:/nice/src/bossa/parser Modified Files: Parser.jj Log Message: Make dispatch on references work across packages. Changed syntax for value patterns: added =value, variable=value, =constant, variable=constant deprecated variable@value removed @null patterns Index: Parser.jj =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/parser/Parser.jj,v retrieving revision 1.183 retrieving revision 1.184 diff -C2 -d -r1.183 -r1.184 *** Parser.jj 12 Jun 2003 17:22:56 -0000 1.183 --- Parser.jj 14 Jun 2003 16:21:26 -0000 1.184 *************** *** 1197,1200 **** --- 1197,1201 ---- { LocatedString name = null; + LocatedString refName = null; Token t; TypeIdent tc=null, additional = null; *************** *** 1209,1232 **** | ( ! t="@" ! | ! t="#" { exactlyAt = true;} ! ) ! ( ! tc=typeIdent() { loc = tc.location(); } | ! //temporarily added to warn the user about the deprecated '@null' syntax. ! t="null" ! { val = NullExp.instance; ! loc = new Location(t); ! User.warning(loc,"The '@null' syntax is deprecated, leave the '@' away."); ! } ) | ! name = ident() ( t ="@" ( ! val=patternLiteral() | tc=typeIdent() --- 1210,1232 ---- | ( ! t="@" tc=typeIdent() { loc = tc.location(); } | ! t="#" tc=typeIdent() { exactlyAt = true; loc = tc.location(); } ! | ! t="=" ! ( ! val=patternLiteral() {loc = val.location(); } ! | ! refName=ident() {loc = refName.location(); } ! ) ) | ! name=ident() ( t ="@" ( ! val=patternLiteral() ! { User.warning(val, ! "This syntax is deprecated.\n" +"leave '"+ name+"@' away.");} | tc=typeIdent() *************** *** 1236,1239 **** --- 1236,1246 ---- t ="#" tc=typeIdent() { exactlyAt = true; } | + t="=" + ( + val=patternLiteral() {loc = val.location(); } + | + refName=ident() {loc = refName.location(); } + ) + | {} //name only ) *************** *** 1242,1246 **** [ "(" additional=typeIdent() ")" ] { ! return new Pattern(name, tc, val, exactlyAt, additional, runtimeTC, loc); } } --- 1249,1253 ---- [ "(" additional=typeIdent() ")" ] { ! return new Pattern(name, refName, tc, val, exactlyAt, additional, runtimeTC, loc); } } |
From: <bo...@us...> - 2003-06-14 14:20:41
|
Update of /cvsroot/nice/Nice/src/bossa/modules In directory sc8-pr-cvs1:/tmp/cvs-serv5010/src/bossa/modules Modified Files: Package.java CompilationListener.nice CompilationInterface.java Compilation.nice Log Message: Report an approximation of how much of the compilation has been completed. Index: Package.java =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/modules/Package.java,v retrieving revision 1.90 retrieving revision 1.91 diff -C2 -d -r1.90 -r1.91 *** Package.java 12 Jun 2003 21:29:54 -0000 1.90 --- Package.java 14 Jun 2003 14:20:38 -0000 1.91 *************** *** 122,125 **** --- 122,126 ---- this.ast = new AST(this, source.getDefinitions(shouldReload)); + compilation.addNumberOfDeclarations(ast.numberOfDeclarations()); if (compiling()) *************** *** 198,201 **** --- 199,229 ---- /**************************************************************** + * Progress + ****************************************************************/ + + /** The average contribution to compile time of the different phases. + The sum should be 1.0 + */ + private static float + PROGRESS_SCOPE = 0.04f, + PROGRESS_LOAD = 0.04f, + PROGRESS_TYPED_RESOLVE = 0.04f, + PROGRESS_LOCAL_RESOLVE = 0.04f, + PROGRESS_TYPECHECK = 0.50f, + PROGRESS_GENERATE_CODE = 0.10f, + PROGRESS_SAVE_INTERFACE = 0.04f, + PROGRESS_LINK = 0.20f; + + void addProgress(float weight) + { + compilation.addProgress(weight * ast.numberOfDeclarations()); + } + + void addGlobalProgress(float weight) + { + compilation.addProgress(weight * compilation.getNumberOfDeclarations()); + } + + /**************************************************************** * Passes ****************************************************************/ *************** *** 209,212 **** --- 237,242 ---- ast.buildScope(); + + addProgress(PROGRESS_SCOPE); } *************** *** 218,221 **** --- 248,253 ---- if (!compiling()) readAlternatives(); + + addProgress(PROGRESS_LOAD); } *************** *** 223,226 **** --- 255,260 ---- { ast.typedResolve(); + + addProgress(PROGRESS_TYPED_RESOLVE); } *************** *** 228,231 **** --- 262,267 ---- { ast.localResolve(); + + addProgress(PROGRESS_LOCAL_RESOLVE); } *************** *** 233,239 **** --- 269,283 ---- { typecheck(); + + addProgress(PROGRESS_TYPECHECK); + compilation.exitIfErrors(); generateCode(); + + addProgress(PROGRESS_GENERATE_CODE); + saveInterface(); + + addProgress(PROGRESS_SAVE_INTERFACE); } *************** *** 300,303 **** --- 344,349 ---- compilation.exitIfErrors(); } + + addGlobalProgress(PROGRESS_LINK); // Write the archive even if nothing was compiled. Index: CompilationListener.nice =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/modules/CompilationListener.nice,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** CompilationListener.nice 11 Jun 2003 22:24:08 -0000 1.1 --- CompilationListener.nice 14 Jun 2003 14:20:38 -0000 1.2 *************** *** 38,40 **** --- 38,44 ---- */ void progress(String packageName, String phase); + + /** Gives an approximation of how much of the compilation has been completed. + */ + void progress(float percent); } Index: CompilationInterface.java =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/modules/CompilationInterface.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** CompilationInterface.java 12 Jun 2003 21:29:54 -0000 1.2 --- CompilationInterface.java 14 Jun 2003 14:20:38 -0000 1.3 *************** *** 29,32 **** --- 29,36 ---- public abstract void progress(Package pkg, String phase); + + public abstract void addNumberOfDeclarations(int number); + public abstract int getNumberOfDeclarations(); + public abstract void addProgress(float weight); } Index: Compilation.nice =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/modules/Compilation.nice,v retrieving revision 1.22 retrieving revision 1.23 diff -C2 -d -r1.22 -r1.23 *** Compilation.nice 12 Jun 2003 21:29:55 -0000 1.22 --- Compilation.nice 14 Jun 2003 14:20:38 -0000 1.23 *************** *** 113,116 **** --- 113,142 ---- listener.progress(notNull(pkg).getName(), notNull(phase)); } + + /**************************************************************** + * Approximation of how far the compilation has gone. + ****************************************************************/ + + /** We wight each package by its number of declarations divided by + the total number. + */ + int totalNumberOfDeclarations = 0; + + getNumberOfDeclarations() = totalNumberOfDeclarations; + + addNumberOfDeclarations(n) + { + totalNumberOfDeclarations += n; + } + + /** We accumulate the progress, because we want to report the total so far. + */ + float totalProgress = 0; + + addProgress(weight) + { + totalProgress += weight / totalNumberOfDeclarations; + listener.progress(totalProgress * 100); + } } |
From: <bo...@us...> - 2003-06-14 14:20:41
|
Update of /cvsroot/nice/Nice/src/bossa/syntax In directory sc8-pr-cvs1:/tmp/cvs-serv5010/src/bossa/syntax Modified Files: AST.java Log Message: Report an approximation of how much of the compilation has been completed. Index: AST.java =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/syntax/AST.java,v retrieving revision 1.43 retrieving revision 1.44 diff -C2 -d -r1.43 -r1.44 *** AST.java 11 Jun 2003 22:24:07 -0000 1.43 --- AST.java 14 Jun 2003 14:20:38 -0000 1.44 *************** *** 179,183 **** public String toString() { ! return "Abstract Syntax Tree ("+children.size()+" definitions)"; } --- 179,188 ---- public String toString() { ! return "Abstract Syntax Tree (" + numberOfDeclarations() +" declarations)"; ! } ! ! public int numberOfDeclarations() ! { ! return children.size(); } |
From: <bo...@us...> - 2003-06-14 14:20:41
|
Update of /cvsroot/nice/Nice/src/nice/tools/compiler/console In directory sc8-pr-cvs1:/tmp/cvs-serv5010/src/nice/tools/compiler/console Modified Files: listener.nice Log Message: Report an approximation of how much of the compilation has been completed. Index: listener.nice =================================================================== RCS file: /cvsroot/nice/Nice/src/nice/tools/compiler/console/listener.nice,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** listener.nice 11 Jun 2003 22:26:56 -0000 1.1 --- listener.nice 14 Jun 2003 14:20:38 -0000 1.2 *************** *** 44,47 **** --- 44,52 ---- } + progress(percent) + { + // This is not reported to the console. + } + warning(location, message) { |
From: <ar...@us...> - 2003-06-14 12:05:14
|
Update of /cvsroot/nice/Nice/testsuite/compiler/syntax In directory sc8-pr-cvs1:/tmp/cvs-serv23450/F:/nice/testsuite/compiler/syntax Modified Files: localvariable.testsuite Log Message: Implemented check for redefining local variable, it's not allowed. Index: localvariable.testsuite =================================================================== RCS file: /cvsroot/nice/Nice/testsuite/compiler/syntax/localvariable.testsuite,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** localvariable.testsuite 12 May 2003 12:40:45 -0000 1.5 --- localvariable.testsuite 14 Jun 2003 12:05:07 -0000 1.6 *************** *** 71,72 **** --- 71,94 ---- /// PASS int i,j,k; + + /// FAIL + int x = 5; + int /* /// FAIL HERE */x = 10; + + /// FAIL + int x = -1; + for (int i = 0; i < 5; i++) { + int /* /// FAIL HERE */x = 1; + } + + /// FAIL + int x = 10; + [1,2,3].foreach(int /* /// FAIL HERE */x => {} ); + + /// PASS + boolean test = true; + if (test) { + int x = 5; + } else { + int x = 3; + } |
From: <ar...@us...> - 2003-06-14 12:05:13
|
Update of /cvsroot/nice/Nice/debian In directory sc8-pr-cvs1:/tmp/cvs-serv23450/F:/nice/debian Modified Files: changelog Log Message: Implemented check for redefining local variable, it's not allowed. Index: changelog =================================================================== RCS file: /cvsroot/nice/Nice/debian/changelog,v retrieving revision 1.174 retrieving revision 1.175 diff -C2 -d -r1.174 -r1.175 *** changelog 12 Jun 2003 16:46:52 -0000 1.174 --- changelog 14 Jun 2003 12:05:07 -0000 1.175 *************** *** 16,19 **** --- 16,20 ---- representation of a character c can be obtained by int(c). * Added dispatch on global constants which value is a literal. + * Redefining of local variables in their scope is not allowed anymore. * Bugfixes (Parsing of nested tuples, global constants of type char ...) * Improved some error messages. |
From: <ar...@us...> - 2003-06-14 12:05:11
|
Update of /cvsroot/nice/Nice/src/bossa/syntax In directory sc8-pr-cvs1:/tmp/cvs-serv23450/F:/nice/src/bossa/syntax Modified Files: analyse.nice Log Message: Implemented check for redefining local variable, it's not allowed. Index: analyse.nice =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/syntax/analyse.nice,v retrieving revision 1.72 retrieving revision 1.73 diff -C2 -d -r1.72 -r1.73 *** analyse.nice 11 Jun 2003 22:24:07 -0000 1.72 --- analyse.nice 14 Jun 2003 12:05:04 -0000 1.73 *************** *** 170,173 **** --- 170,174 ---- symbol.syntacticType = null; } + this.checkNotDefined(symbol); this.vars[symbol.name.toString()] = symbol; } *************** *** 182,186 **** throw error(symbol, "A variable cannot have a void type"); } ! this.vars[symbol.name.toString()] = symbol; } --- 183,187 ---- throw error(symbol, "A variable cannot have a void type"); } ! this.checkNotDefined(symbol); this.vars[symbol.name.toString()] = symbol; } *************** *** 191,194 **** --- 192,204 ---- void addTypeVars(Array<TypeSymbol> symbols) = symbols.foreach(TypeSymbol s => this.typeVars[s.toString()] = s); + + void checkNotDefined(VarSymbol symbol) + { + ?VarSymbol old = this.vars[symbol.name.toString()]; + if (old != null) + throw error(symbol, "Symbol " + symbol.name + " is already defined at " + + "line " + old.location().getLine() + + ", column " + old.location().getColumn()); + } } |
From: <bo...@us...> - 2003-06-14 10:43:37
|
Update of /cvsroot/nice/Nice/web In directory sc8-pr-cvs1:/tmp/cvs-serv15630/web Modified Files: manual.xml Log Message: Minor updates. Index: manual.xml =================================================================== RCS file: /cvsroot/nice/Nice/web/manual.xml,v retrieving revision 1.22 retrieving revision 1.23 diff -C2 -d -r1.22 -r1.23 *** manual.xml 12 Jun 2003 16:43:01 -0000 1.22 --- manual.xml 14 Jun 2003 10:43:34 -0000 1.23 *************** *** 589,598 **** 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 dispatch can be more flexible than switch or if/else statements, because you can always add new alternatives conveniently by ! just implementing a new method override. </para> <example> --- 589,598 ---- 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 dispatch can be more flexible than switch or if/else statements, because you can always add new alternatives conveniently by ! just adding a new method implementation. </para> <example> *************** *** 745,748 **** --- 745,749 ---- Constants are declared with "let": </para> + <para> <literal>let <optional><replaceable>type</replaceable></optional> <replaceable>variable-name</replaceable> *************** *** 750,756 **** ; </literal> <para> If the variable or constant is of a simple type (i.e., not a ! <link linked="parametricClasses">parameterized type</link>), then it is not necessary to specify the type yourself, the compiler can infer the correct type automatically. --- 751,758 ---- ; </literal> + </para> <para> If the variable or constant is of a simple type (i.e., not a ! <link linkend="parametricClasses">parameterized type</link>), then it is not necessary to specify the type yourself, the compiler can infer the correct type automatically. *************** *** 762,768 **** conceptual unit, variable and constant declarations may appear outside class definitions, and are useful in the same way that ! static variables in Java are. Their syntax is identical to the ! syntax for local variables, except that either <literal>var</literal> ! or <literal>let</literal> must be used, the Java style is not accepted. </para> </section> --- 764,771 ---- conceptual unit, variable and constant declarations may appear outside class definitions, and are useful in the same way that ! static variables in Java are. Package variables are introduced ! with <literal>var</literal>, and package constants with ! <literal>let</literal>. The type must be specified, since it is ! a useful documentation. </para> </section> *************** *** 1469,1474 **** <title>Abstract Interfaces</title> <para> ! Nice offers a powerful tool known as the <firstterm>abstract interface ! </firstterm>. Abstract interfaces are similar in some respects to regular Java- or Nice-style interfaces in that they define a set of methods that a type must implement to be considered a member of the interface. --- 1472,1477 ---- <title>Abstract Interfaces</title> <para> ! Nice offers a powerful tool known as the <firstterm>abstract interface</firstterm>. ! Abstract interfaces are similar in some respects to regular Java- or Nice-style interfaces in that they define a set of methods that a type must implement to be considered a member of the interface. *************** *** 1478,1482 **** First, a class can be made to implement an abstract interface <emphasis>after</emphasis> it's been defined, and even the source code is unnecessary. You can make ! the basic String class implement your new abstract interface, if you like. Second, an abstract interface is not actually a type, it's an annotation which can be applied to types. This means that when you declare an abstract --- 1481,1486 ---- First, a class can be made to implement an abstract interface <emphasis>after</emphasis> it's been defined, and even the source code is unnecessary. You can make ! the basic <literal>String</literal> class implement your new ! abstract interface, if you like. Second, an abstract interface is not actually a type, it's an annotation which can be applied to types. This means that when you declare an abstract *************** *** 1501,1506 **** below. We have a <literal>log()</literal> method which is parameterized for any class which implements the abstract interface <literal>LogEntry</literal>, ! and we make a number of classes implement LogEntry, so they can be passed ! to our log method. </para> <para> --- 1505,1510 ---- below. We have a <literal>log()</literal> method which is parameterized for any class which implements the abstract interface <literal>LogEntry</literal>, ! and we make a number of classes implement ! <literal>LogEntry</literal>, so they can be passed to our log method. </para> <para> *************** *** 1515,1521 **** //Some constants for severity levels ! let DEBUG = 1; ! let INFO = 2; ! let ERROR = 3; <LogEntry E> void log(E entry, int severity = -1) --- 1519,1525 ---- //Some constants for severity levels ! let int DEBUG = 1; ! let int INFO = 2; ! let int ERROR = 3; <LogEntry E> void log(E entry, int severity = -1) *************** *** 1567,1571 **** </para> <para> ! <literal><programlisting language = "nice"> log(request); log("Beginning processing"); --- 1571,1575 ---- </para> <para> ! <programlisting lang="nice"> log(request); log("Beginning processing"); *************** *** 1578,1582 **** log(e); } ! </programlisting></literal> </para> <para> --- 1582,1586 ---- log(e); } ! </programlisting> </para> <para> *************** *** 1589,1598 **** <E> void log(E entry, int severity = -1)</literal>, we could have achieved all the same effects, but we would have lost the ! type safety abstract interfaces gave us above - because <E> ! means <emphasis>any</emphasis> type is allowed, so we would have ! had to define some defaults: </para> <para> ! <literal><programlisting language = "nice"> toLogString(e) { --- 1593,1602 ---- <E> void log(E entry, int severity = -1)</literal>, we could have achieved all the same effects, but we would have lost the ! type safety abstract interfaces gave us above - because ! <literal><E></literal> means <emphasis>any</emphasis> ! type is allowed, so we would have had to define some defaults: </para> <para> ! <programlisting lang="nice"> toLogString(e) { *************** *** 1604,1612 **** throw new Exception("No severity method defined!"); } ! </programlisting></literal> </para> <para> Then we'd be no better off than in a dynamically typed language - ! we wouldn't find out that we'd tried to log a 5 until we got an exception at runtime. With abstract interfaces, we were able to tell the compiler <emphasis>exactly</emphasis> which classes --- 1608,1616 ---- throw new Exception("No severity method defined!"); } ! </programlisting> </para> <para> Then we'd be no better off than in a dynamically typed language - ! we wouldn't find out that we'd tried to log an integer until we got an exception at runtime. With abstract interfaces, we were able to tell the compiler <emphasis>exactly</emphasis> which classes |
From: <ar...@us...> - 2003-06-14 08:37:16
|
Update of /cvsroot/nice/Nice/stdlib/nice/doc In directory sc8-pr-cvs1:/tmp/cvs-serv3374/F:/nice/stdlib/nice/doc Modified Files: man.nice Log Message: cleanup some detail. Index: man.nice =================================================================== RCS file: /cvsroot/nice/Nice/stdlib/nice/doc/man.nice,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** man.nice 13 Jun 2003 21:54:30 -0000 1.5 --- man.nice 14 Jun 2003 08:37:13 -0000 1.6 *************** *** 26,35 **** StringBuffer res = new StringBuffer(); ! void appendSection(String section, ?String txt) { ! if (txt == null) return; - String text = notNull(txt); res.append(".SH ").append(section).append('\n'); res.append(text); --- 26,34 ---- StringBuffer res = new StringBuffer(); ! void appendSection(String section, ?String text) { ! if (text == null) return; res.append(".SH ").append(section).append('\n'); res.append(text); |
From: <ar...@us...> - 2003-06-13 22:45:31
|
Update of /cvsroot/nice/Nice/src/nice/tools/testsuite In directory sc8-pr-cvs1:/tmp/cvs-serv6484/F:/nice/src/nice/tools/testsuite Modified Files: TestNice.java Log Message: Sort the testsuite files on their last modification time. Index: TestNice.java =================================================================== RCS file: /cvsroot/nice/Nice/src/nice/tools/testsuite/TestNice.java,v retrieving revision 1.25 retrieving revision 1.26 diff -C2 -d -r1.25 -r1.26 *** TestNice.java 26 Apr 2003 12:44:16 -0000 1.25 --- TestNice.java 13 Jun 2003 22:45:28 -0000 1.26 *************** *** 358,364 **** Set testSuiteFiles = new HashSet(); getTestSuiteFiles(file, testSuiteFiles); ! for (Iterator iter = testSuiteFiles.iterator(); iter.hasNext();) new TestSuite((File)iter.next()); } --- 358,394 ---- Set testSuiteFiles = new HashSet(); getTestSuiteFiles(file, testSuiteFiles); ! ! // sort the files on last modification time. ! List files = new ArrayList(testSuiteFiles); ! Collections.sort(files, fileComp); ! ! for (Iterator iter = files.iterator(); iter.hasNext();) new TestSuite((File)iter.next()); } + + private static Comparator fileComp = new FileComparator(); + + private static class FileComparator implements Comparator + { + public FileComparator(){} + + public int compare(Object o1, Object o2) + { + File file1 = (File)o1; + File file2 = (File)o2; + if (file1.lastModified() < file2.lastModified()) + return 1; + + if (file1.lastModified() > file2.lastModified()) + return -1; + + return 0; + } + + public boolean equals(Object obj) + { + return false; + } + } |
From: <ar...@us...> - 2003-06-13 22:13:40
|
Update of /cvsroot/nice/Nice/src/bossa/syntax In directory sc8-pr-cvs1:/tmp/cvs-serv1707/F:/nice/src/bossa/syntax Modified Files: LoopStmt.java Log Message: Don't redefine local variables in existing nice code. Index: LoopStmt.java =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/syntax/LoopStmt.java,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -d -r1.14 -r1.15 *** LoopStmt.java 13 Jun 2003 14:57:52 -0000 1.14 --- LoopStmt.java 13 Jun 2003 22:13:37 -0000 1.15 *************** *** 55,59 **** itertype.nullness = Monotype.sure; getiter = CallExp.create(new IdentExp(new LocatedString("forIterator", loc)), container); ! iter = new LocatedString("for_in_iter", loc); init = new Block.LocalVariable(iter, itertype, true, getiter); iterexp = new IdentExp(iter); --- 55,59 ---- itertype.nullness = Monotype.sure; getiter = CallExp.create(new IdentExp(new LocatedString("forIterator", loc)), container); ! iter = new LocatedString("for_in_iter_"+loc.getLine()+"_"+loc.getColumn(), loc); init = new Block.LocalVariable(iter, itertype, true, getiter); iterexp = new IdentExp(iter); |
From: <ar...@us...> - 2003-06-13 21:54:33
|
Update of /cvsroot/nice/Nice/testsuite/compiler/statements/loops In directory sc8-pr-cvs1:/tmp/cvs-serv30914/F:/nice/testsuite/compiler/statements/loops Modified Files: break.testsuite Log Message: Don't redefine local variables in existing nice code. Index: break.testsuite =================================================================== RCS file: /cvsroot/nice/Nice/testsuite/compiler/statements/loops/break.testsuite,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** break.testsuite 10 Jun 2003 19:32:57 -0000 1.3 --- break.testsuite 13 Jun 2003 21:54:30 -0000 1.4 *************** *** 25,29 **** for (int i = 0; i < 5; i++) { ! for (int i = 0; i < 5; i++) continue; if (true) continue; --- 25,29 ---- for (int i = 0; i < 5; i++) { ! for (int j = 0; j < 5; j++) continue; if (true) continue; |
From: <ar...@us...> - 2003-06-13 21:54:33
|
Update of /cvsroot/nice/Nice/src/nice/tools/compiler/console In directory sc8-pr-cvs1:/tmp/cvs-serv30914/F:/nice/src/nice/tools/compiler/console Modified Files: main.nice Log Message: Don't redefine local variables in existing nice code. Index: main.nice =================================================================== RCS file: /cvsroot/nice/Nice/src/nice/tools/compiler/console/main.nice,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** main.nice 11 Jun 2003 22:26:56 -0000 1.1 --- main.nice 13 Jun 2003 21:54:30 -0000 1.2 *************** *** 50,55 **** boolean editorMode = false; ! ConsoleOutput output = new ConsoleOutput(); ! Compilation compilation = new Compilation(listener: output); Program prg = new Program --- 50,55 ---- boolean editorMode = false; ! ConsoleOutput consOutput = new ConsoleOutput(); ! Compilation compilation = new Compilation(listener: consOutput); Program prg = new Program *************** *** 169,173 **** compile(compilation, mainPackage, nativeProgram, nativeCompiler, editorMode); ! int res = output.statusCode; if (memInfo) printMemoryUsage(); --- 169,173 ---- compile(compilation, mainPackage, nativeProgram, nativeCompiler, editorMode); ! int res = consOutput.statusCode; if (memInfo) printMemoryUsage(); |