nice-commit Mailing List for The Nice Programming Language (Page 98)
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-24 15:28:24
|
Update of /cvsroot/nice/Nice/src/bossa/link In directory sc8-pr-cvs1:/tmp/cvs-serv20812/src/bossa/link Modified Files: ImportedAlternative.java Log Message: Refactored bossa.util.Location, to provide a higher-level view on locations, using several subclasses for the different cases. Index: ImportedAlternative.java =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/link/ImportedAlternative.java,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** ImportedAlternative.java 18 Apr 2003 14:50:27 -0000 1.4 --- ImportedAlternative.java 24 Jun 2003 15:28:19 -0000 1.5 *************** *** 93,97 **** LocatedString methodName = new LocatedString (fullName.substring(JavaMethod.fullNamePrefix.length(), end), ! bossa.util.Location.nowhereAtAll()); List methods = bossa.syntax.Node.getGlobalScope().lookup(methodName); --- 93,97 ---- LocatedString methodName = new LocatedString (fullName.substring(JavaMethod.fullNamePrefix.length(), end), ! bossa.util.Location.nowhere()); List methods = bossa.syntax.Node.getGlobalScope().lookup(methodName); |
From: <bo...@us...> - 2003-06-24 15:28:24
|
Update of /cvsroot/nice/Nice/src/bossa/util In directory sc8-pr-cvs1:/tmp/cvs-serv20812/src/bossa/util Modified Files: UserError.java Location.java Log Message: Refactored bossa.util.Location, to provide a higher-level view on locations, using several subclasses for the different cases. Index: UserError.java =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/util/UserError.java,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** UserError.java 7 Apr 2003 20:35:33 -0000 1.7 --- UserError.java 24 Jun 2003 15:28:19 -0000 1.8 *************** *** 36,41 **** public UserError(gnu.expr.Expression responsible, String message) { ! this(new Location(responsible.getFile(), responsible.getLine(), ! responsible.getColumn()), message); } --- 36,41 ---- public UserError(gnu.expr.Expression responsible, String message) { ! this(Location.make(new java.io.File(responsible.getFile()), ! responsible.getLine(), responsible.getColumn()), message); } Index: Location.java =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/util/Location.java,v retrieving revision 1.23 retrieving revision 1.24 diff -C2 -d -r1.23 -r1.24 *** Location.java 20 Feb 2003 14:58:39 -0000 1.23 --- Location.java 24 Jun 2003 15:28:19 -0000 1.24 *************** *** 1,6 **** /**************************************************************************/ ! /* B O S S A */ ! /* A simple imperative object-oriented research language */ ! /* (c) Daniel Bonniot 1999 */ /* */ /* This program is free software; you can redistribute it and/or modify */ --- 1,6 ---- /**************************************************************************/ ! /* 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 */ *************** *** 11,18 **** /**************************************************************************/ - // File : Location.java - // Created : Tue Jul 13 11:55:08 1999 by bonniot - //$Modified: Tue Oct 03 12:02:39 2000 by Daniel Bonniot $ - package bossa.util; --- 11,14 ---- *************** *** 22,189 **** /** ! * Represents a portion of the input file. ! * Used to report errors to the user. ! * ! * @see Located */ ! public class Location implements Located { ! /** ! * The file beeing parsed. ! * Enables to set the file name just once, ! * not at each Location construction. ! */ ! public static void setCurrentFile(String file) { ! currentFile = nice.tools.util.System.prettyPrintFile(file); } - private static String currentFile = null; ! public static Location current = null; ! ! public Location(String file, ! int startLine, int startColumn, ! int endLine, int endColumn) { ! this.fileName = file; ! this.startLine = startLine; ! this.startColumn = startColumn; ! this.endLine = endLine; ! this.endColumn = endColumn; } ! public Location( ! int startLine, int startColumn, ! int endLine, int endColumn) { ! this(currentFile, startLine, startColumn, endLine, endColumn); } ! public Location(String fileName, int startLine, int startColumn) { ! this(fileName, startLine, startColumn, -1, -1); } ! public Location(String fileName) { ! this(fileName, -1, -1); } ! public Location(String abstractLocation, boolean dummy) { ! this.abstractLocation = abstractLocation; } ! public Location(Token t) { ! this(t.beginLine,t.beginColumn,t.endLine,t.endColumn); } /** ! Return a location that goes from start to end. ! */ ! public Location(Token start, Token end) { ! this(start.beginLine, start.beginColumn, end.endLine, end.endColumn); } ! /** returns the "invalid" location */ ! public static Location nowhere() { - return new Location(-1,-1,-1,-1); } ! public static Location nowhereAtAll() { - return new Location(null, -1,-1,-1,-1); } ! public String toString() { ! if (abstractLocation != null) ! return "[" + abstractLocation + "]"; ! String res; ! if (fileName != null) ! res = fileName; ! else ! res = ""; ! if (!isValid()) ! if (Debug.powerUser) ! return "[no location]: " + res; ! else ! return res; ! if (editorMode) ! return ! (res.length()>0 ? (res + ":") : "") + ! startLine + ":" + startColumn; ! else ! return ! (res.length()>0 ? (res + ": ") : "") + ! "line "+startLine+", column "+startColumn; ! } ! public boolean isValid() ! { ! return abstractLocation!=null || startLine>=0; ! } ! ! public Location englobe(Location loc) ! { ! return new Location(fileName, ! startLine, startColumn, loc.endLine, loc.endColumn); ! } ! public Location englobe(Collection /* of Located */ locs) ! { ! List llocs = (List) locs; ! return englobe(((Located)llocs.get(llocs.size()-1)).location()); ! } ! public Location location() ! { ! return this; } - public int getLine() - { - return startLine; - } - - public int getColumn() - { - return startColumn; - } - - public String getFile() - { - return fileName; - } - /**************************************************************** ! * Setting source location in the generated bytecode. ****************************************************************/ ! public void write(gnu.expr.Expression exp) { ! exp.setFile(getFile()); ! exp.setLine(getLine(), getColumn()); ! } ! /**************************************************************** ! * Private state. ! ****************************************************************/ ! private int startLine,startColumn,endLine,endColumn; ! private String fileName; ! private String abstractLocation = null; // if non-null, overseeds everyting /**************************************************************** ! * Different behaviour wether compiler is invoked by an editor. ****************************************************************/ ! public static boolean editorMode = false; } --- 18,228 ---- /** ! Represents a portion of the input file. ! Used to report errors to the user. ! ! @see Located ! ! @author Daniel Bonniot (bo...@us...) */ ! public abstract class Location implements Located { ! public static Location make ! (java.io.File file, ! int startLine, int startColumn, ! int endLine, int endColumn) { ! return new Source(file, startLine, startColumn, endLine, endColumn); } ! public static Location make ! (java.io.File file, ! int startLine, int startColumn) { ! return make(file, startLine, startColumn, -1, -1); } ! public static Location make ! (int startLine, int startColumn, ! int endLine, int endColumn) { ! return make(currentFile, startLine, startColumn, endLine, endColumn); } ! public static Location make (Token t) { ! return make(t.beginLine, t.beginColumn, t.endLine, t.endColumn); } ! /** ! Return a location that goes from start to end. ! */ ! public static Location make (Token start, Token end) { ! return make(start.beginLine, start.beginColumn, end.endLine, end.endColumn); } ! /** ! * The file beeing parsed. ! * Enables to set the file name just once, ! * not at each Location construction. ! */ ! public static void setCurrentFile(java.io.File file) { ! currentFile = file; } + private static java.io.File currentFile = null; ! public static final Location option = new Option(); ! ! public static Location nowhere() ! { ! return new Location.File(currentFile); ! } ! ! public Location location() { ! return this; } /** ! Return an identifier, which is guaranteed to be different for ! different locations. ! */ ! public String uniqueIdentifier(String root) { ! StringBuffer uniq = new StringBuffer(super.toString()); ! // Replace the '@' in bossa.util.Location@12345 with '_' ! uniq.setCharAt("bossa.util.Location".length(), '_'); ! ! return root + uniq.toString(); } ! /**************************************************************** ! * Setting source location in the generated bytecode. ! ****************************************************************/ ! ! public void write(gnu.expr.Expression exp) { } ! public void write(gnu.expr.Declaration decl) { } ! /**************************************************************** ! * Different behaviour wether compiler is invoked by an editor. ! ****************************************************************/ ! ! public static boolean editorMode = false; ! ! /**************************************************************** ! * File location ! ****************************************************************/ ! ! public static class File extends Location { ! private File(java.io.File file) ! { ! this.file = file; ! } ! private java.io.File file; ! public java.io.File getFile() { return file; } ! public String toString() ! { ! return nice.tools.util.System.prettyPrint(file); ! } ! public void write(gnu.expr.Expression exp) ! { ! if (file == null) ! return; ! // In the bytecode, the fully qualified name is not wanted. ! exp.setFile(file.getName()); ! } ! public void write(gnu.expr.Declaration decl) ! { ! if (file == null) ! return; ! // In the bytecode, the fully qualified name is not wanted. ! decl.setFile(file.getName()); ! } } /**************************************************************** ! * Source location ****************************************************************/ ! public static class Source extends File { ! private Source(java.io.File file, ! int startLine, int startColumn, ! int endLine, int endColumn) ! { ! super(file); ! this.startLine = startLine; ! this.startColumn = startColumn; ! this.endLine = endLine; ! this.endColumn = endColumn; ! } ! private int startLine,startColumn,endLine,endColumn; ! ! public int getLine() ! { ! return startLine; ! } ! public int getColumn() ! { ! return startColumn; ! } ! ! public String toString() ! { ! String res = super.toString(); ! if (editorMode) ! return ! (res.length()>0 ? (res + ":") : "") + ! startLine + ":" + startColumn; ! else ! return ! (res.length()>0 ? (res + ": ") : "") + ! "line "+startLine+", column "+startColumn; ! } ! ! public String uniqueIdentifier(String root) ! { ! return root + startLine + "_" + startColumn; ! } ! ! public void write(gnu.expr.Expression exp) ! { ! super.write(exp); ! exp.setLine(getLine(), getColumn()); ! } + public void write(gnu.expr.Declaration decl) + { + super.write(decl); + decl.setLine(getLine(), getColumn()); + } + } + /**************************************************************** ! * A compilation option ****************************************************************/ ! public static class Option extends Location ! { ! public String toString() ! { ! return "Command line"; ! } ! } } |
From: <bo...@us...> - 2003-06-24 15:28:24
|
Update of /cvsroot/nice/Nice/src/bossa/parser In directory sc8-pr-cvs1:/tmp/cvs-serv20812/src/bossa/parser Modified Files: Parser.jj Loader.java Log Message: Refactored bossa.util.Location, to provide a higher-level view on locations, using several subclasses for the different cases. Index: Parser.jj =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/parser/Parser.jj,v retrieving revision 1.189 retrieving revision 1.190 diff -C2 -d -r1.189 -r1.190 *** Parser.jj 19 Jun 2003 15:57:23 -0000 1.189 --- Parser.jj 24 Jun 2003 15:28:19 -0000 1.190 *************** *** 38,42 **** private static IdentExp symb(String name, Token t, boolean quoted) { ! return new IdentExp(new LocatedString(name,new Location(t),quoted)); } private static IdentExp symb(String name, Token t) --- 38,42 ---- private static IdentExp symb(String name, Token t, boolean quoted) { ! return new IdentExp(new LocatedString(name, Location.make(t),quoted)); } private static IdentExp symb(String name, Token t) *************** *** 370,374 **** { t=<IDENT> ! { return new LocatedString(t.image,new Location(t)); } } --- 370,374 ---- { t=<IDENT> ! { return new LocatedString(t.image, Location.make(t)); } } *************** *** 391,395 **** name=<BACKQUOTEDSTRING> { res = new LocatedString(name.image.substring(1, name.image.length() - 1), ! new Location(name), true); } | --- 391,395 ---- name=<BACKQUOTEDSTRING> { res = new LocatedString(name.image.substring(1, name.image.length() - 1), ! Location.make(name), true); } | *************** *** 420,438 **** LocatedString doted_string(): { ! Token t; StringBuffer image; - Location loc; } { ! t = <IDENT> ! { image = new StringBuffer(t.image); loc = new Location(t); } ( LOOKAHEAD(2) // needed to distinguish with ".class" "." t=doted_string_component() ! { image.append(".").append(t.image); ! loc.englobe(new Location(t)); } )* ! { return new LocatedString(image.toString(), loc); } } --- 420,436 ---- LocatedString doted_string(): { ! Token start, t; StringBuffer image; } { ! start = <IDENT> ! { t = start; image = new StringBuffer(start.image); } ( LOOKAHEAD(2) // needed to distinguish with ".class" "." t=doted_string_component() ! { image.append(".").append(t.image); } )* ! { return new LocatedString(image.toString(), Location.make(start, t)); } } *************** *** 440,458 **** LocatedString fullyQualifiedName(): { ! Token t; StringBuffer image; - Location loc; } { ! t = <IDENT> ! { image = new StringBuffer(t.image); loc = new Location(t); } ( LOOKAHEAD(2) // needed to distinguish with ".class" "." t=doted_string_component() ! { image.append(".").append(t.image); ! loc.englobe(new Location(t)); } )+ ! { return new LocatedString(image.toString(), loc); } } --- 438,454 ---- LocatedString fullyQualifiedName(): { ! Token start, t; StringBuffer image; } { ! start = <IDENT> ! { t = start; image = new StringBuffer(t.image); } ( LOOKAHEAD(2) // needed to distinguish with ".class" "." t=doted_string_component() ! { image.append(".").append(t.image); } )+ ! { return new LocatedString(image.toString(), Location.make(start, t)); } } *************** *** 484,488 **** { t = <FLOATING_POINT_LITERAL> ! { return new LocatedString(t.image, new Location(t)); } } --- 480,484 ---- { t = <FLOATING_POINT_LITERAL> ! { return new LocatedString(t.image, Location.make(t)); } } *************** *** 493,497 **** { t = <INTEGER_LITERAL> ! { return new LocatedString(t.image, new Location(t)); } } --- 489,493 ---- { t = <INTEGER_LITERAL> ! { return new LocatedString(t.image, Location.make(t)); } } *************** *** 708,712 **** return new MonotypeConstructor(t,new TypeParameters(p), ! new Location(first, last)); } } --- 704,708 ---- return new MonotypeConstructor(t,new TypeParameters(p), ! Location.make(first, last)); } } *************** *** 739,745 **** Monotype res; if (domain != null) ! res = new TupleType(domain, new Location(start, end)); else ! res = new TypeIdent(new LocatedString("void",new Location(start, end))); res.nullness = res.absent; --- 735,741 ---- Monotype res; if (domain != null) ! res = new TupleType(domain, Location.make(start, end)); else ! res = new TypeIdent(new LocatedString("void",Location.make(start, end))); res.nullness = res.absent; *************** *** 751,755 **** { Monotype res; } { - res = simpleMonotype() res = arrayMonotype(res) --- 747,750 ---- *************** *** 797,801 **** List tp = new LinkedList(); tp.add(res); ! Location loc = res.location().englobe(new Location(end)); res = new MonotypeConstructor (new TypeIdent(new LocatedString("nice.lang.Array", loc)), --- 792,796 ---- List tp = new LinkedList(); tp.add(res); ! Location loc = res.location(); res = new MonotypeConstructor (new TypeIdent(new LocatedString("nice.lang.Array", loc)), *************** *** 824,828 **** | start="alike" [ "<" p=monotypes() ">" ] ! { res=new Alike(p, new Location(start)); } { res.nullness = res.absent; } | --- 819,823 ---- | start="alike" [ "<" p=monotypes() ">" ] ! { res=new Alike(p, Location.make(start)); } { res.nullness = res.absent; } | *************** *** 880,884 **** ( "," part = ParameterTuplePart(statements, types) { parts.add(part); } )+ last=")" ! { Monotype t = new TupleType(types, new Location(first, last)); t.nullness = Monotype.absent; monotypes.add(t); --- 875,879 ---- ( "," part = ParameterTuplePart(statements, types) { parts.add(part); } )+ last=")" ! { Monotype t = new TupleType(types, Location.make(first, last)); t.nullness = Monotype.absent; monotypes.add(t); *************** *** 919,928 **** { if (id == null) { ident = new LocatedString("tuple_arg_" + first.beginLine + "_" + first.beginColumn, ! new Location(first, last)); } else { ident = id; } Expression exp = AssignExp.create(new TupleExp(parts),new IdentExp(ident)); ! exp.setLocation(new Location(first,last)); statements.add(new ExpressionStmt(exp)); ! t = new TupleType(types, new Location(first, last)); t.nullness = Monotype.absent; if (val != null) --- 914,923 ---- { if (id == null) { ident = new LocatedString("tuple_arg_" + first.beginLine + "_" + first.beginColumn, ! Location.make(first, last)); } else { ident = id; } Expression exp = AssignExp.create(new TupleExp(parts),new IdentExp(ident)); ! exp.setLocation(Location.make(first,last)); statements.add(new ExpressionStmt(exp)); ! t = new TupleType(types, Location.make(first, last)); t.nullness = Monotype.absent; if (val != null) *************** *** 1026,1030 **** { isFinal=true; if (t!=null) ! User.warning(new Location(t), "'const' is deprecated. Use 'final' instead."); } --- 1021,1025 ---- { isFinal=true; if (t!=null) ! User.warning(Location.make(t), "'const' is deprecated. Use 'final' instead."); } *************** *** 1359,1363 **** [ { Token t; } t="<" binders=strings() ">" ! { User.warning(new Location(t), "This syntax is deprecated.\n" + "Type parameters should now be placed in front of the method implementation."); --- 1354,1358 ---- [ { Token t; } t="<" binders=strings() ">" ! { User.warning(Location.make(t), "This syntax is deprecated.\n" + "Type parameters should now be placed in front of the method implementation."); *************** *** 1606,1611 **** } { ! t = "true" { return ConstantExp.makeBoolean(true, new Location(t)); } ! | t = "false" { return ConstantExp.makeBoolean(false, new Location(t)); } } --- 1601,1606 ---- } { ! t = "true" { return ConstantExp.makeBoolean(true, Location.make(t)); } ! | t = "false" { return ConstantExp.makeBoolean(false, Location.make(t)); } } *************** *** 1636,1640 **** { return ConstantExp.makeChar (new LocatedString(t.image.substring(1, t.image.length() - 1), ! new Location(t))); } } --- 1631,1635 ---- { return ConstantExp.makeChar (new LocatedString(t.image.substring(1, t.image.length() - 1), ! Location.make(t))); } } *************** *** 1671,1675 **** arguments = arguments(false) { e = new NewExp(classe, arguments); ! e.setLocation(new Location(t)); return e; } --- 1666,1670 ---- arguments = arguments(false) { e = new NewExp(classe, arguments); ! e.setLocation(Location.make(t)); return e; } *************** *** 1721,1730 **** { if (ident == null) { name = new LocatedString("tuple_arg_" + first.beginLine + "_" + first.beginColumn, ! new Location(first, last)); } else { name = ident; } Expression exp = AssignExp.create(new TupleExp(parts),new IdentExp(name)); ! exp.setLocation(new Location(first,last)); statements.add(new ExpressionStmt(exp)); ! type = new TupleType(types, new Location(first, last)); type.nullness = Monotype.absent; return new MonoSymbol(name, type); --- 1716,1725 ---- { if (ident == null) { name = new LocatedString("tuple_arg_" + first.beginLine + "_" + first.beginColumn, ! Location.make(first, last)); } else { name = ident; } Expression exp = AssignExp.create(new TupleExp(parts),new IdentExp(name)); ! exp.setLocation(Location.make(first,last)); statements.add(new ExpressionStmt(exp)); ! type = new TupleType(types, Location.make(first, last)); type.nullness = Monotype.absent; return new MonoSymbol(name, type); *************** *** 1921,1925 **** { last=getToken(0); ! e1.setLocation(new Location(first, last)); return e1; } --- 1916,1920 ---- { last=getToken(0); ! e1.setLocation(Location.make(first, last)); return e1; } *************** *** 1931,1935 **** e1=ConditionalExpression() [ ! { e1.setLocation(new Location(start, getToken(0))); } op=AssignmentOperator() e2=Expression() --- 1926,1930 ---- e1=ConditionalExpression() [ ! { e1.setLocation(Location.make(start, getToken(0))); } op=AssignmentOperator() e2=Expression() *************** *** 1971,1975 **** [ "?" e1=Expression() start=":" e2=ConditionalExpression() ! { e2.setLocation(new Location(start, getToken(0))); res=new IfExp(res,e1,e2); } ] --- 1966,1970 ---- [ "?" e1=Expression() start=":" e2=ConditionalExpression() ! { e2.setLocation(Location.make(start, getToken(0))); res=new IfExp(res,e1,e2); } ] *************** *** 2455,2459 **** { last = getToken(0); ! res.setLocation(new Location(first, last)); } return res; --- 2450,2454 ---- { last = getToken(0); ! res.setLocation(Location.make(first, last)); } return res; *************** *** 2489,2493 **** last = getToken(0); Statement res = new Block(statements); ! res.setLocation(new Location(first, last)); return res; } --- 2484,2488 ---- last = getToken(0); Statement res = new Block(statements); ! res.setLocation(Location.make(first, last)); return res; } *************** *** 2541,2545 **** ( (t="final" | t="const") ! {User.warning(new Location(t), "'"+t.toString()+"' is deprecated. Use 'let' instead."); } --- 2536,2540 ---- ( (t="final" | t="const") ! {User.warning(Location.make(t), "'"+t.toString()+"' is deprecated. Use 'let' instead."); } *************** *** 2581,2585 **** ( (t="final" | t="const") ! {User.warning(new Location(t), "'"+t.toString()+"' is deprecated. Use 'let' instead."); } --- 2576,2580 ---- ( (t="final" | t="const") ! {User.warning(Location.make(t), "'"+t.toString()+"' is deprecated. Use 'let' instead."); } *************** *** 2609,2613 **** "=" e=Expression() ";" { Expression exp = AssignExp.create(new TupleExp(parts), e); ! exp.setLocation(new Location(first,last)); return new ExpressionStmt(exp); } } --- 2604,2608 ---- "=" e=Expression() ";" { Expression exp = AssignExp.create(new TupleExp(parts), e); ! exp.setLocation(Location.make(first,last)); return new ExpressionStmt(exp); } } *************** *** 2683,2687 **** { Token t; } { ! t=";" { return new EmptyStmt(new Location(t)); } } --- 2678,2682 ---- { Token t; } { ! t=";" { return new EmptyStmt(Location.make(t)); } } *************** *** 2707,2711 **** | { Token op; Expression e2; ! e1.setLocation(new Location(first, getToken(0))); } op=AssignmentOperator() --- 2702,2706 ---- | { Token op; Expression e2; ! e1.setLocation(Location.make(first, getToken(0))); } op=AssignmentOperator() *************** *** 2721,2725 **** { last = getToken(0); ! e1.setLocation(new Location(first, last)); return new ExpressionStmt(e1); } --- 2716,2720 ---- { last = getToken(0); ! e1.setLocation(Location.make(first, last)); return new ExpressionStmt(e1); } *************** *** 2756,2760 **** ifExp = new IfExp(cond, new StatementExp(s1), (s2 == null ? null : new StatementExp(s2))); ! ifExp.setLocation(new Location(first, getToken(0))); return new ExpressionStmt(ifExp); } --- 2751,2755 ---- ifExp = new IfExp(cond, new StatementExp(s1), (s2 == null ? null : new StatementExp(s2))); ! ifExp.setLocation(Location.make(first, getToken(0))); return new ExpressionStmt(ifExp); } *************** *** 2774,2778 **** ifExp = new IfExp(cond, new StatementExp(s1), (s2 == null ? null : new StatementExp(s2))); ! ifExp.setLocation(new Location(first, getToken(0))); return new ExpressionStmt(ifExp); } --- 2769,2773 ---- ifExp = new IfExp(cond, new StatementExp(s1), (s2 == null ? null : new StatementExp(s2))); ! ifExp.setLocation(Location.make(first, getToken(0))); return new ExpressionStmt(ifExp); } *************** *** 2826,2830 **** vartype=monotype() var=ident() t=":" container=Expression() ")" body=Statement() ! {return LoopStmt.forInLoop(vartype,var,new Location(t),container,body); } } --- 2821,2825 ---- vartype=monotype() var=ident() t=":" container=Expression() ")" body=Statement() ! { return LoopStmt.forInLoop(vartype,var,Location.make(t),container,body); } } *************** *** 2869,2873 **** { Statement res = new ReturnStmt(val); ! res.setLocation(new Location(t)); return res; } --- 2864,2868 ---- { Statement res = new ReturnStmt(val); ! res.setLocation(Location.make(t)); return res; } Index: Loader.java =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/parser/Loader.java,v retrieving revision 1.18 retrieving revision 1.19 diff -C2 -d -r1.18 -r1.19 *** Loader.java 8 Mar 2003 14:27:12 -0000 1.18 --- Loader.java 24 Jun 2003 15:28:19 -0000 1.19 *************** *** 44,48 **** catch(ParseException e){ if(e.currentToken!=null) ! User.error(new Location(e.currentToken.next), removeLocation(e.getMessage())); else --- 44,48 ---- catch(ParseException e){ if(e.currentToken!=null) ! User.error(Location.make(e.currentToken.next), removeLocation(e.getMessage())); else *************** *** 70,74 **** catch(ParseException e){ if(e.currentToken!=null) ! User.error(new Location(e.currentToken.next), removeLocation(e.getMessage())); else --- 70,74 ---- catch(ParseException e){ if(e.currentToken!=null) ! User.error(Location.make(e.currentToken.next), removeLocation(e.getMessage())); else |
From: <bo...@us...> - 2003-06-24 15:28:23
|
Update of /cvsroot/nice/Nice/src/bossa/syntax In directory sc8-pr-cvs1:/tmp/cvs-serv20812/src/bossa/syntax Modified Files: analyse.nice VarSymbol.java UserOperator.java NiceClass.java LoopStmt.java JavaMethod.java Contract.java ClassExp.java Block.java AST.java Log Message: Refactored bossa.util.Location, to provide a higher-level view on locations, using several subclasses for the different cases. Index: analyse.nice =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/syntax/analyse.nice,v retrieving revision 1.73 retrieving revision 1.74 diff -C2 -d -r1.73 -r1.74 *** analyse.nice 14 Jun 2003 12:05:04 -0000 1.73 --- analyse.nice 24 Jun 2003 15:28:19 -0000 1.74 *************** *** 197,203 **** ?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()); } } --- 197,202 ---- ?VarSymbol old = this.vars[symbol.name.toString()]; if (old != null) ! throw error(symbol, "Symbol " + symbol.name + " is already defined.\n" + ! "Previous definition: " + old.location().toString()); } } Index: VarSymbol.java =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/syntax/VarSymbol.java,v retrieving revision 1.29 retrieving revision 1.30 diff -C2 -d -r1.29 -r1.30 *** VarSymbol.java 17 Jun 2003 12:03:05 -0000 1.29 --- VarSymbol.java 24 Jun 2003 15:28:19 -0000 1.30 *************** *** 172,176 **** this.decl = declaration; this.isThis = isThis; ! if (name != null) this.decl.setLine(name.location().getLine()); this.decl.setCanRead(true); this.decl.setCanWrite(true); --- 172,177 ---- this.decl = declaration; this.isThis = isThis; ! if (name != null) ! name.location.write(this.decl); this.decl.setCanRead(true); this.decl.setCanWrite(true); Index: UserOperator.java =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/syntax/UserOperator.java,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** UserOperator.java 26 May 2003 21:22:36 -0000 1.4 --- UserOperator.java 24 Jun 2003 15:28:19 -0000 1.5 *************** *** 72,76 **** // The contract must be resolved after the formal parameters since they // can refer to them. ! contract.resolve(scope, typeScope, getReturnType()); } --- 72,76 ---- // The contract must be resolved after the formal parameters since they // can refer to them. ! contract.resolve(scope, typeScope, getReturnType(), location()); } Index: NiceClass.java =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/syntax/NiceClass.java,v retrieving revision 1.47 retrieving revision 1.48 diff -C2 -d -r1.47 -r1.48 *** NiceClass.java 22 Jun 2003 09:51:56 -0000 1.47 --- NiceClass.java 24 Jun 2003 15:28:19 -0000 1.48 *************** *** 264,268 **** gnu.expr.ClassExp classe = new gnu.expr.ClassExp(); classe.setName(definition.name.toString()); ! classe.setFile(definition.location().getFile()); classe.setSimple(true); classe.setAccessFlags(definition.getBytecodeFlags()); --- 264,268 ---- gnu.expr.ClassExp classe = new gnu.expr.ClassExp(); classe.setName(definition.name.toString()); ! definition.location().write(classe); classe.setSimple(true); classe.setAccessFlags(definition.getBytecodeFlags()); Index: LoopStmt.java =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/syntax/LoopStmt.java,v retrieving revision 1.15 retrieving revision 1.16 diff -C2 -d -r1.15 -r1.16 *** LoopStmt.java 13 Jun 2003 22:13:37 -0000 1.15 --- LoopStmt.java 24 Jun 2003 15:28:19 -0000 1.16 *************** *** 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); --- 55,59 ---- itertype.nullness = Monotype.sure; getiter = CallExp.create(new IdentExp(new LocatedString("forIterator", loc)), container); ! iter = new LocatedString(loc.uniqueIdentifier("for_in_iter_"), loc); init = new Block.LocalVariable(iter, itertype, true, getiter); iterexp = new IdentExp(iter); Index: JavaMethod.java =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/syntax/JavaMethod.java,v retrieving revision 1.26 retrieving revision 1.27 diff -C2 -d -r1.26 -r1.27 *** JavaMethod.java 17 Jun 2003 12:03:05 -0000 1.26 --- JavaMethod.java 24 Jun 2003 15:28:19 -0000 1.27 *************** *** 59,66 **** res = new JavaConstructor (new LocatedString ! ("new " + m.getDeclaringClass().getName(), Location.current), type, m); else ! res = new JavaMethod(new LocatedString(m.getName(), Location.current), type, m); return res; --- 59,66 ---- res = new JavaConstructor (new LocatedString ! ("new " + m.getDeclaringClass().getName(), Location.nowhere()), type, m); else ! res = new JavaMethod(new LocatedString(m.getName(), Location.nowhere()), type, m); return res; Index: Contract.java =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/syntax/Contract.java,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** Contract.java 29 May 2003 14:17:17 -0000 1.4 --- Contract.java 24 Jun 2003 15:28:19 -0000 1.5 *************** *** 56,60 **** void resolve(VarScope scope, TypeScope typeScope, ! mlsub.typing.Monotype resultType) { preExp = new Expression[pre.size()]; --- 56,61 ---- void resolve(VarScope scope, TypeScope typeScope, ! mlsub.typing.Monotype resultType, ! Location location) { preExp = new Expression[pre.size()]; *************** *** 64,69 **** scope, typeScope); if (! nice.tools.code.Types.isVoid(resultType)) ! result = new MonoSymbol(resultName, resultType) { boolean isAssignable() { return false; } --- 65,77 ---- scope, typeScope); + if (post.size() == 0) + { + postExp = Expression.noExpressions; + return; + } + if (! nice.tools.code.Types.isVoid(resultType)) ! result = new MonoSymbol(new LocatedString("result", location), ! resultType) { boolean isAssignable() { return false; } *************** *** 87,93 **** } } - - private static final LocatedString resultName = - new LocatedString("result", Location.nowhereAtAll()); private Expression[] preExp, postExp; --- 95,98 ---- Index: ClassExp.java =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/syntax/ClassExp.java,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** ClassExp.java 6 Dec 2002 15:36:48 -0000 1.10 --- ClassExp.java 24 Jun 2003 15:28:19 -0000 1.11 *************** *** 76,83 **** { Expression res = new ClassExp((gnu.bytecode.ClassType) type); ! Location loc = name.location(); ! if (root != null && root.location() != null) ! loc = root.location().englobe(loc); ! res.setLocation(loc); return res; } --- 76,80 ---- { Expression res = new ClassExp((gnu.bytecode.ClassType) type); ! res.setLocation(root == null ? name.location() : root.location()); return res; } Index: Block.java =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/syntax/Block.java,v retrieving revision 1.59 retrieving revision 1.60 diff -C2 -d -r1.59 -r1.60 *** Block.java 28 May 2003 12:57:25 -0000 1.59 --- Block.java 24 Jun 2003 15:28:19 -0000 1.60 *************** *** 347,351 **** res.setBody(addLocals(vars,body)); ! res.setLine(local.location().getLine()); return res; --- 347,351 ---- res.setBody(addLocals(vars,body)); ! local.location().write(res); return res; Index: AST.java =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/syntax/AST.java,v retrieving revision 1.46 retrieving revision 1.47 diff -C2 -d -r1.46 -r1.47 *** AST.java 22 Jun 2003 09:51:56 -0000 1.46 --- AST.java 24 Jun 2003 15:28:19 -0000 1.47 *************** *** 79,84 **** { Node.setModule(module); - Location.setCurrentFile(module.toString()); - Location.current = Location.nowhere(); // Classes are resolved first, since code can depend on them --- 79,82 ---- |
From: <bo...@us...> - 2003-06-24 10:00:44
|
Update of /cvsroot/nice/Nice/src/bossa/syntax In directory sc8-pr-cvs1:/tmp/cvs-serv8111/src/bossa/syntax Modified Files: RetypedJavaMethod.java Log Message: Minor. Index: RetypedJavaMethod.java =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/syntax/RetypedJavaMethod.java,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** RetypedJavaMethod.java 23 Jun 2003 17:49:01 -0000 1.5 --- RetypedJavaMethod.java 24 Jun 2003 10:00:41 -0000 1.6 *************** *** 103,113 **** return; ! Type holder = TypeImport.lookup(className); ! if(holder == null) User.error(this, "Class " + className + " was not found"); ! if(!(holder instanceof ClassType)) User.error(className, className + " is a primitive type"); className = new LocatedString(holder.getName(), className.location()); --- 103,114 ---- return; ! Type holderType = TypeImport.lookup(className); ! if (holderType == null) User.error(this, "Class " + className + " was not found"); ! if (!(holderType instanceof ClassType)) User.error(className, className + " is a primitive type"); + ClassType holder = (ClassType) holderType; className = new LocatedString(holder.getName(), className.location()); *************** *** 133,138 **** retTypeString.location())); ! reflectMethod = ! ((ClassType) holder).getDeclaredMethod (methodName, javaArgType); if (reflectMethod == null) --- 134,138 ---- retTypeString.location())); ! reflectMethod = holder.getDeclaredMethod(methodName, javaArgType); if (reflectMethod == null) *************** *** 140,145 **** try { reflectMethod = ! ((ClassType) holder).getDeclaredMethod (methodName, ! javaArgType.length); } catch (Error e) { User.error(this, "The types of the arguments don't exactly match any of the declarations"); --- 140,144 ---- try { reflectMethod = ! holder.getDeclaredMethod(methodName, javaArgType.length); } catch (Error e) { User.error(this, "The types of the arguments don't exactly match any of the declarations"); *************** *** 151,155 **** else User.error(className, "No method named " + methodName + " with " + ! javaArgType.length +" arguments was not found in class " + holder.getName()); } --- 150,154 ---- else User.error(className, "No method named " + methodName + " with " + ! javaArgType.length + " arguments was found in class " + holder.getName()); } |
From: <bo...@us...> - 2003-06-24 09:16:47
|
Update of /cvsroot/nice/Nice/stdlib/nice/doc In directory sc8-pr-cvs1:/tmp/cvs-serv2385/stdlib/nice/doc Modified Files: main.nice Log Message: Added standard options that are automatically generated (-h, --help). Index: main.nice =================================================================== RCS file: /cvsroot/nice/Nice/stdlib/nice/doc/main.nice,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** main.nice 9 Sep 2002 12:59:25 -0000 1.3 --- main.nice 24 Jun 2003 09:16:43 -0000 1.4 *************** *** 2,6 **** /* N I C E */ /* A high-level object-oriented research language */ ! /* (c) Daniel Bonniot 2001 */ /* */ /* This program is free software; you can redistribute it and/or modify */ --- 2,6 ---- /* 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 */ *************** *** 42,45 **** and returns the non-options arguments. */ List<String> parse(Program prg, String[] arguments) = ! parse(prg.name, arguments, prg.options); --- 42,50 ---- and returns the non-options arguments. */ List<String> parse(Program prg, String[] arguments) = ! parse(prg.name, arguments, concat(prg.options, standardOptions(prg))); + Option[] standardOptions(Program prg) = + [ + option(letter: 'h', "help", "Print help message and exit", + () => help(prg)) + ]; |
From: <bo...@us...> - 2003-06-24 09:16:46
|
Update of /cvsroot/nice/Nice/src/nice/tools/compiler/console In directory sc8-pr-cvs1:/tmp/cvs-serv2385/src/nice/tools/compiler/console Modified Files: main.nice Log Message: Added standard options that are automatically generated (-h, --help). Index: main.nice =================================================================== RCS file: /cvsroot/nice/Nice/src/nice/tools/compiler/console/main.nice,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** main.nice 13 Jun 2003 21:54:30 -0000 1.2 --- main.nice 24 Jun 2003 09:16:43 -0000 1.3 *************** *** 125,131 **** - option(letter: 'h', "help", "Print help message and exit", - () => help(prg)), - option("editor", "Tell nicec that it is called by an editor.", () => { editorMode = true; }), --- 125,128 ---- |
From: <bo...@us...> - 2003-06-24 09:07:46
|
Update of /cvsroot/nice/Nice/web In directory sc8-pr-cvs1:/tmp/cvs-serv1232/web Modified Files: manual.xml Log Message: Documented the generation of constructors when a Nice class has a Java parent. Also added the generation of the alternate constructor when calling from Java, which omits the fields with default values. Index: manual.xml =================================================================== RCS file: /cvsroot/nice/Nice/web/manual.xml,v retrieving revision 1.26 retrieving revision 1.27 diff -C2 -d -r1.26 -r1.27 *** manual.xml 19 Jun 2003 21:09:59 -0000 1.26 --- manual.xml 24 Jun 2003 09:06:57 -0000 1.27 *************** *** 1047,1050 **** --- 1047,1053 ---- Therefore it is straightforward to use existing Java code in Nice programs. + In particular, it is possible to call Java methods, to + instantiate Java classes, to create a Nice subclass of a Java + class, overriding methods from the parent, ... </para> *************** *** 1054,1057 **** --- 1057,1077 ---- </para> + <section id="subclassJavaInNice"><title>Subclassing a Java class</title> + <para> + A Nice class can extend a Java class, simply by naming it in + its <literal>extends</literal> clause. Similarly, it can + implement Java interfaces. + </para> + + <para> + When instantiating a Nice class with a Java parent, the + <link linkend="constructor">automatic constructor</link> + comes in several versions, one for each constructor of the + parent class. The call must then provide the values for one + of the constructors of the parent, followed by the named + values for the fields defined in the Nice class. + </para> + </section> + <section id="importJava"><title>Importing packages</title> <para> *************** *** 1187,1190 **** --- 1207,1214 ---- with one parameter for each field of the class, including those inherited from Nice super-classes. + Additionally, if some fields have default values, then a + second constructor is generated. It only has parameters for + the fields without a default value, and assigns to the other + fields their default value. </para> </section> |
From: <ar...@us...> - 2003-06-23 17:49:04
|
Update of /cvsroot/nice/Nice/src/gnu/bytecode In directory sc8-pr-cvs1:/tmp/cvs-serv2394/F:/nice/src/gnu/bytecode Modified Files: Method.java Log Message: improved some error messages related to retyping of java types. Index: Method.java =================================================================== RCS file: /cvsroot/nice/Nice/src/gnu/bytecode/Method.java,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** Method.java 9 Sep 2002 12:59:26 -0000 1.5 --- Method.java 23 Jun 2003 17:49:01 -0000 1.6 *************** *** 354,360 **** { StringBuffer sbuf = new StringBuffer(100); sbuf.append(getDeclaringClass().getName()); ! sbuf.append('.'); ! sbuf.append(name); if (arg_types != null) { --- 354,369 ---- { StringBuffer sbuf = new StringBuffer(100); + if (isConstructor()) + sbuf.append("new"); + else + sbuf.append(return_type.getName()); + + sbuf.append(" "); sbuf.append(getDeclaringClass().getName()); ! if (!isConstructor()) ! { ! sbuf.append('.'); ! sbuf.append(name); ! } if (arg_types != null) { *************** *** 368,372 **** } sbuf.append(')'); - sbuf.append(return_type.getName()); } return sbuf.toString(); --- 377,380 ---- |
From: <ar...@us...> - 2003-06-23 17:49:04
|
Update of /cvsroot/nice/Nice/src/bossa/syntax In directory sc8-pr-cvs1:/tmp/cvs-serv2394/F:/nice/src/bossa/syntax Modified Files: NewExp.java RetypedJavaMethod.java Log Message: improved some error messages related to retyping of java types. Index: NewExp.java =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/syntax/NewExp.java,v retrieving revision 1.35 retrieving revision 1.36 diff -C2 -d -r1.35 -r1.36 *** NewExp.java 12 Jun 2003 21:04:40 -0000 1.35 --- NewExp.java 23 Jun 2003 17:49:01 -0000 1.36 *************** *** 64,68 **** LinkedList constructors = TypeConstructors.getConstructors(tc); if (constructors == null) ! User.error(this, "Class " + tc + " has no constructor"); // the list of constructors must be cloned, as --- 64,74 ---- LinkedList constructors = TypeConstructors.getConstructors(tc); if (constructors == null) ! { ! if (tc.arity() > 0) ! User.error(this, "Class " + tc + " has no constructor with the correct number of " + ! tc.arity() + " type parameters.\nA retyping is needed to use this constructor."); ! else ! User.error(this, "Class " + tc + " has no constructor"); ! } // the list of constructors must be cloned, as Index: RetypedJavaMethod.java =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/syntax/RetypedJavaMethod.java,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** RetypedJavaMethod.java 23 Jun 2003 16:15:21 -0000 1.4 --- RetypedJavaMethod.java 23 Jun 2003 17:49:01 -0000 1.5 *************** *** 136,146 **** ((ClassType) holder).getDeclaredMethod (methodName, javaArgType); ! if(reflectMethod == null) ! User.error(className, ! (methodName.equals("<init>") ! ? "Constructor" ! : "Method " + methodName) + ! " was not found in class " + holder.getName()); // use the following, or the Type.flushTypeChanges() in SpecialTypes //reflectMethod.arg_types = javaArgType; --- 136,162 ---- ((ClassType) holder).getDeclaredMethod (methodName, javaArgType); ! if (reflectMethod == null) ! { ! try { ! reflectMethod = ! ((ClassType) holder).getDeclaredMethod (methodName, ! javaArgType.length); ! } catch (Error e) { ! User.error(this, "The types of the arguments don't exactly match any of the declarations"); ! } ! if (reflectMethod == null) ! { ! if (methodName.equals("<init>")) ! User.error(className, "class " + holder.getName() + " has no constructor with " + javaArgType.length + " arguments"); ! else ! User.error(className, "No method named " + methodName + " with " + ! javaArgType.length +" arguments was not found in class " + ! holder.getName()); ! } + User.error(className, "The types of the arguments don't match the declaration:\n" + + reflectMethod); + + } // use the following, or the Type.flushTypeChanges() in SpecialTypes //reflectMethod.arg_types = javaArgType; |
From: <bo...@us...> - 2003-06-23 16:15:25
|
Update of /cvsroot/nice/Nice/src/bossa/syntax In directory sc8-pr-cvs1:/tmp/cvs-serv15314/src/bossa/syntax Modified Files: RetypedJavaMethod.java Log Message: Slightly improve the error messages. Index: RetypedJavaMethod.java =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/syntax/RetypedJavaMethod.java,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** RetypedJavaMethod.java 15 Nov 2002 13:48:05 -0000 1.3 --- RetypedJavaMethod.java 23 Jun 2003 16:15:21 -0000 1.4 *************** *** 109,113 **** if(!(holder instanceof ClassType)) ! User.error(this, className + " is a primitive type"); className = new LocatedString(holder.getName(), className.location()); --- 109,113 ---- if(!(holder instanceof ClassType)) ! User.error(className, className + " is a primitive type"); className = new LocatedString(holder.getName(), className.location()); *************** *** 137,141 **** if(reflectMethod == null) ! User.error(this, "Method " + methodName + " was not found in class " + holder.getName()); --- 137,144 ---- if(reflectMethod == null) ! User.error(className, ! (methodName.equals("<init>") ! ? "Constructor" ! : "Method " + methodName) + " was not found in class " + holder.getName()); |
From: <bo...@us...> - 2003-06-22 10:11:47
|
Update of /cvsroot/nice/tester In directory sc8-pr-cvs1:/tmp/cvs-serv14633 Modified Files: run Log Message: Properly handle JDK_VERSION when it is not set in every config Index: run =================================================================== RCS file: /cvsroot/nice/tester/run,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** run 12 May 2003 17:00:25 -0000 1.8 --- run 22 Jun 2003 10:11:44 -0000 1.9 *************** *** 48,51 **** --- 48,56 ---- for conffile in ../config.*; do name="`expr match $conffile '../config\.\(.*\)'`" + + # Blamk the variable, so it does not keep the previous value if it + # is not reset to a new value. + JDK_VERSION= + . $conffile |
From: <bo...@us...> - 2003-06-22 10:10:55
|
Update of /cvsroot/nice/tester In directory sc8-pr-cvs1:/tmp/cvs-serv14542 Modified Files: cvs Log Message: Try up to 20 times Index: cvs =================================================================== RCS file: /cvsroot/nice/tester/cvs,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** cvs 12 May 2003 17:02:25 -0000 1.1 --- cvs 22 Jun 2003 10:10:52 -0000 1.2 *************** *** 6,10 **** # cvs <module name> ! # Try at most 10 times times, in case the cvs server is busy tries=0 --- 6,10 ---- # cvs <module name> ! # Try at most 20 times times, in case the cvs server is busy tries=0 *************** *** 14,18 **** tries=`expr $tries + 1` ! if [ $tries -ge 10 ]; then # Signal that we failed because of a network problem exit 1 --- 14,18 ---- tries=`expr $tries + 1` ! if [ $tries -ge 20 ]; then # Signal that we failed because of a network problem exit 1 |
From: <bo...@us...> - 2003-06-22 09:57:27
|
Update of /cvsroot/nice/Nice/debian In directory sc8-pr-cvs1:/tmp/cvs-serv13216/debian Modified Files: changelog Log Message: Tried to arrange the changelog in a somewhat logical order. Index: changelog =================================================================== RCS file: /cvsroot/nice/Nice/debian/changelog,v retrieving revision 1.183 retrieving revision 1.184 diff -C2 -d -r1.183 -r1.184 *** changelog 22 Jun 2003 09:54:53 -0000 1.183 --- changelog 22 Jun 2003 09:57:23 -0000 1.184 *************** *** 6,18 **** foo("red") { ... } foo(color) { println("unknown color: " + color); } - * Added operator ** to calculate powers of longs, doubles and BigIntegers. - * Archives (generated with the -a option) can now be used to distribute - Nice libraries. - * Interfaces can now implement (finally or not) abstract interfaces. - * 'true' and 'false' are now keywords, and better code is generated for them. - The termination properties of loops with literal boolean values are now - recognized, as in Java. - * The 'char' type is no longer a subtype of int. The integer unicode - representation of a character c can be obtained by int(c). * Added dispatch on global constants whose value is a literal. Example: let int specialValue = 7; --- 6,9 ---- *************** *** 20,24 **** foo(n) { /*do something*/ } foo(=specialValue) { /*do something else*/ } - * Redefining of local variables in their scope is not allowed anymore. * Dispatch on global constants works also for unique references(new objects). class Color {} --- 11,14 ---- *************** *** 29,32 **** --- 19,37 ---- name(=red) = "red"; name(=blue) = "blue"; + * Implemented simple enums. The above color example can be simplified to: + enum Color { red, blue, green } + String name(Color); + name(=red) = "red"; + name(=blue) = "blue"; + name(=green) = "green"; + The compiler knows now that the method "name" is completely covered. + * Added operator ** to calculate powers of longs, doubles and BigIntegers. + * The 'char' type is no longer a subtype of int. The integer unicode + representation of a character c can be obtained by int(c). + * Interfaces can now implement (finally or not) abstract interfaces. + * 'true' and 'false' are now keywords, and better code is generated for them. + The termination properties of loops with literal boolean values are now + recognized, as in Java. + * Redefining of local variables in their scope is not allowed anymore. * Method bodies with a single statement can be written without brackets. example: void foo() = throw new Exception; *************** *** 38,48 **** tuples.foreach(((String name, int number)) => println("name: "+name+" number: "+number) ); ! * Implemented simple enums. The above color example can be simplified to: ! enum Color { red, blue, green } ! String name(Color); ! name(=red) = "red"; ! name(=blue) = "blue"; ! name(=green) = "green"; ! The compiler knows now that the method "name" is completely covered. * In the bytecode, two versions of the instance constructors are created: one which lists all the fields, the other one that lists only those --- 43,48 ---- tuples.foreach(((String name, int number)) => println("name: "+name+" number: "+number) ); ! * Archives (generated with the -a option) can now be used to distribute ! Nice libraries. * In the bytecode, two versions of the instance constructors are created: one which lists all the fields, the other one that lists only those |
From: <bo...@us...> - 2003-06-22 09:54:56
|
Update of /cvsroot/nice/Nice/debian In directory sc8-pr-cvs1:/tmp/cvs-serv12876/debian Modified Files: changelog Log Message: Generate bytecode instance constructors that omit the fields with default values, in addition to the ones listing all fields. Index: changelog =================================================================== RCS file: /cvsroot/nice/Nice/debian/changelog,v retrieving revision 1.182 retrieving revision 1.183 diff -C2 -d -r1.182 -r1.183 *** changelog 21 Jun 2003 09:03:55 -0000 1.182 --- changelog 22 Jun 2003 09:54:53 -0000 1.183 *************** *** 45,48 **** --- 45,53 ---- name(=green) = "green"; The compiler knows now that the method "name" is completely covered. + * In the bytecode, two versions of the instance constructors are created: + one which lists all the fields, the other one that lists only those + without default value. This is useful when instantiating Nice classes + from Java source or by reflexion, especially if a no-arg constructor is + required for some reason. * Bugfixes (Parsing of nested tuples, global constants of type char, Overloading resolving of methods implementation with additional tc's, ...) |
From: <bo...@us...> - 2003-06-22 09:52:00
|
Update of /cvsroot/nice/Nice/src/bossa/modules In directory sc8-pr-cvs1:/tmp/cvs-serv12418/src/bossa/modules Modified Files: Package.java Log Message: Generate bytecode instance constructors that omit the fields with default values, in addition to the ones listing all fields. Index: Package.java =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/modules/Package.java,v retrieving revision 1.91 retrieving revision 1.92 diff -C2 -d -r1.91 -r1.92 *** Package.java 14 Jun 2003 14:20:38 -0000 1.91 --- Package.java 22 Jun 2003 09:51:56 -0000 1.92 *************** *** 321,330 **** // An interface file does not have to be typecheked. // It is known to be type correct from previous compilation! ! if (!compiling()) ! return; ! ! compilation.progress(this, "typechecking"); ! ast.typechecking(); } --- 321,331 ---- // An interface file does not have to be typecheked. // It is known to be type correct from previous compilation! ! // We still call ast.typechecking, but with a value telling ! // that only bookeeping tasks are needed, and we don't advertise ! // this pass. ! if (compiling()) ! compilation.progress(this, "typechecking"); ! ast.typechecking(compiling()); } *************** *** 602,605 **** --- 603,614 ---- { thisPkg.addClass(classe); + + /* If a class need an outer frame (for instance if the constructor + defines an anonymous function), then use the dispatch class. + The implementation class would be inappropriate, since it is + not regenerated when importing a compiled package, while + classes and the dispatch class are. + */ + classe.outer = dispatchClass; } |
From: <bo...@us...> - 2003-06-22 09:51:59
|
Update of /cvsroot/nice/Nice/src/bossa/syntax In directory sc8-pr-cvs1:/tmp/cvs-serv12418/src/bossa/syntax Modified Files: NiceClass.java FormalParameters.java Constructor.java AST.java Log Message: Generate bytecode instance constructors that omit the fields with default values, in addition to the ones listing all fields. Index: NiceClass.java =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/syntax/NiceClass.java,v retrieving revision 1.46 retrieving revision 1.47 diff -C2 -d -r1.46 -r1.47 *** NiceClass.java 28 May 2003 12:57:26 -0000 1.46 --- NiceClass.java 22 Jun 2003 09:51:56 -0000 1.47 *************** *** 398,402 **** (gnu.bytecode.Type.pointer_type.getDeclaredMethod("<init>", 0))); ! gnu.expr.Expression getSuper(int index) { TypeConstructor tc = definition.getSuperClass(); --- 398,402 ---- (gnu.bytecode.Type.pointer_type.getDeclaredMethod("<init>", 0))); ! gnu.expr.Expression getSuper(int index, boolean omitDefaults) { TypeConstructor tc = definition.getSuperClass(); *************** *** 408,412 **** if (sup != null && sup.implementation instanceof NiceClass) return ((NiceClass) sup.implementation). ! constructorMethod[index].getConstructorInvocation(); List constructors = TypeConstructors.getConstructors(tc); --- 408,412 ---- if (sup != null && sup.implementation instanceof NiceClass) return ((NiceClass) sup.implementation). ! constructorMethod[index].getConstructorInvocation(omitDefaults); List constructors = TypeConstructors.getConstructors(tc); Index: FormalParameters.java =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/syntax/FormalParameters.java,v retrieving revision 1.24 retrieving revision 1.25 diff -C2 -d -r1.24 -r1.25 *** FormalParameters.java 12 May 2003 18:00:40 -0000 1.24 --- FormalParameters.java 22 Jun 2003 09:51:56 -0000 1.25 *************** *** 294,297 **** --- 294,302 ---- } + boolean hasDefaultValue(int rank) + { + return parameters[rank].value() != null; + } + /**************************************************************** * Walk methods, used in NiceMethod.create Index: Constructor.java =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/syntax/Constructor.java,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** Constructor.java 28 May 2003 12:57:26 -0000 1.4 --- Constructor.java 22 Jun 2003 09:51:56 -0000 1.5 *************** *** 54,93 **** private int index; ! Expression getConstructorInvocation() { getCode(); return new QuoteExp(new InitializeProc(lambda)); } private ConstructorExp lambda; protected Expression computeCode() { ! MonoSymbol[] args = parameters.getMonoSymbols(); ! ClassType classType = (ClassType) javaReturnType(); ! lambda = Gen.createConstructor(classType, javaArgTypes(), args); Expression[] body = new Expression[1 + fields.length]; ! Expression thisExp = new ThisExp(classType); ! body[0] = callSuper(thisExp, args); ! for (int i = fields.length, n = args.length - 1 ; --i >= 0; n--) ! body[i + 1] = fields[i].method.compileAssign(thisExp, args[n].compile()); ! Gen.setMethodBody(lambda, new BeginExp(body)); classe.getClassExp().addMethod(lambda); ! return new QuoteExp(new InstantiateProc(lambda)); } ! private Expression callSuper(Expression thisExp, MonoSymbol[] args) { int len = args.length - fields.length; ! Expression[] superArgs = new Expression[1 + len]; ! superArgs[0] = thisExp; for (int i = 0; i < len; i++) ! superArgs[i + 1] = args[i].compile(); ! Expression superExp = classe.getSuper(index); ! return new ApplyExp(superExp, superArgs); } --- 54,155 ---- private int index; ! Expression getConstructorInvocation(boolean omitDefaults) { getCode(); + ConstructorExp lambda = + // lambdaOmitDefaults is null if the two versions are identical + omitDefaults && lambdaOmitDefaults != null + ? lambdaOmitDefaults : this.lambda; return new QuoteExp(new InitializeProc(lambda)); } + /** The constructor, with all the arguments. */ private ConstructorExp lambda; + /** The constructor, with only non-default. */ + private ConstructorExp lambdaOmitDefaults; + protected Expression computeCode() { ! this.lambdaOmitDefaults = createBytecode(true); ! this.lambda = createBytecode(false); ! return new QuoteExp(new InstantiateProc(this.lambda)); ! } ! ! /** ! @param omitDefaults if true, do not take the value of fields with ! default values as parameters, but use that default instead. ! */ ! private ConstructorExp createBytecode(boolean omitDefaults) ! { ! ClassType thisType = (ClassType) javaReturnType(); ! Expression thisExp = new ThisExp(thisType); ! ! MonoSymbol[] fullArgs = parameters.getMonoSymbols(); ! Type[] fullArgTypes = javaArgTypes(); ! ! List args = new LinkedList(); ! List argTypes = new LinkedList(); ! ! for (int i = 0; i < parameters.size; i++) ! { ! if (omitDefaults && parameters.hasDefaultValue(i)) ! continue; ! ! args.add(fullArgs[i]); ! argTypes.add(fullArgTypes[i]); ! } ! ! // Do not create a second constructor omiting defaults if there is ! // no default to omit! ! if (omitDefaults && args.size() == fullArgs.length) ! return null; ! ! ConstructorExp lambda = Gen.createConstructor ! (thisType, ! (Type[]) argTypes.toArray(new Type[argTypes.size()]), ! (MonoSymbol[]) args.toArray(new MonoSymbol[args.size()])); ! Expression[] body = new Expression[1 + fields.length]; ! body[0] = callSuper(thisExp, fullArgs, omitDefaults); ! final int superArgs = fullArgs.length - fields.length; ! for (int i = 0; i < fields.length; i++) ! { ! bossa.syntax.Expression value = fields[i].value; ! ! Expression fieldValue; ! if (!omitDefaults || value == null) ! // Use the provided parameter. ! fieldValue = fullArgs[superArgs + i].compile(); ! else ! // Use the default value. ! fieldValue = value.compile(); + body[ i + 1] = fields[i].method.compileAssign(thisExp, fieldValue); + } + + Gen.setMethodBody(lambda, new BeginExp(body)); classe.getClassExp().addMethod(lambda); ! ! return lambda; } ! private Expression callSuper(Expression thisExp, MonoSymbol[] args, ! boolean omitDefaults) { int len = args.length - fields.length; ! List/*Expression*/ superArgs = new LinkedList(); ! superArgs.add(thisExp); for (int i = 0; i < len; i++) ! { ! if (! (omitDefaults && parameters.hasDefaultValue(i))) ! superArgs.add(args[i].compile()); ! } ! Expression superExp = classe.getSuper(index, omitDefaults); ! return new ApplyExp(superExp, (Expression[]) ! superArgs.toArray(new Expression[superArgs.size()])); } Index: AST.java =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/syntax/AST.java,v retrieving revision 1.45 retrieving revision 1.46 diff -C2 -d -r1.45 -r1.46 *** AST.java 19 Jun 2003 15:57:23 -0000 1.45 --- AST.java 22 Jun 2003 09:51:56 -0000 1.46 *************** *** 144,154 **** } ! public void typechecking() { Node.setModule(module); // Classes are typechecked first, since code can depend on them. ! for(int i = 0; i < classes.length; i++) classes[i].typecheckClass(); doTypecheck(); --- 144,157 ---- } ! public void typechecking(boolean compiling) { Node.setModule(module); // Classes are typechecked first, since code can depend on them. ! for (int i = 0; i < classes.length; i++) classes[i].typecheckClass(); + + if (! compiling) + return; doTypecheck(); |
From: <bo...@us...> - 2003-06-22 09:51:59
|
Update of /cvsroot/nice/Nice/testsuite/compiler/native In directory sc8-pr-cvs1:/tmp/cvs-serv12418/testsuite/compiler/native Added Files: constructors.testsuite Log Message: Generate bytecode instance constructors that omit the fields with default values, in addition to the ones listing all fields. --- NEW FILE: constructors.testsuite --- /// PASS /// package pkg // We check that there is a no-arg constructor, accessible by reflexion Class c = Class.forName("pkg.Nice"); Constructor make = c.getConstructor(null); Nice instance = cast(make.newInstance(null)); assert instance.s.equals("default") && instance.i == 17; /// Toplevel import java.lang.reflect.*; class Nice { String s = "default"; int i = 17; } /// PASS new Nice(s: ""); /// Toplevel class Nice { String s; } /// PASS /// Toplevel class A { String s = ""; } class B extends A {} /// PASS /// Toplevel class A {} class B extends A { String s = ""; } /// PASS /// package pkg /* java.lang.Thread has many constructors, including one () and one (Runnable). There is therefore ambiguity in A(Runnable x) between super.() + this.dummy = x and super.(x) + this.dummy = null In this case the second interpretation must be taken. */ Class c = Class.forName("pkg.A"); Constructor make = c.getConstructor([Runnable.class]); boolean ran = false; Runnable r = thread(() => ran = true); A instance = cast(make.newInstance([object(r)])); instance.start(); try { instance.join(); } catch(InterruptedException ex) {} assert ran; /// Toplevel import java.lang.reflect.*; class A extends Thread { ?Runnable dummy = null; } |
From: <bo...@us...> - 2003-06-21 09:08:01
|
Update of /cvsroot/nice/Nice/testsuite/compiler/enums In directory sc8-pr-cvs1:/tmp/cvs-serv12102/testsuite/compiler/enums Added Files: serialization.testsuite Removed Files: serializazion.testsuite Log Message: Fixed typo in the file name, and marked it as a know "bug". --- NEW FILE: serialization.testsuite --- /// PASS bug let filename = "color.ser"; let outf = new FileOutputStream(filename); let outs = new ObjectOutputStream(outf); outs.writeObject(red); outf.close(); let inf = new FileInputStream(filename); let ins = new ObjectInputStream(inf); let Color color = ins.readObject(); assert color == red; /// Toplevel import java.io.*; enum Color {red, blue, green} --- serializazion.testsuite DELETED --- |
From: <bo...@us...> - 2003-06-21 09:05:31
|
Update of /cvsroot/nice/Nice/stdlib/nice/lang In directory sc8-pr-cvs1:/tmp/cvs-serv11926/stdlib/nice/lang Modified Files: java.nice Log Message: Retyping for java.util.Observer.update Index: java.nice =================================================================== RCS file: /cvsroot/nice/Nice/stdlib/nice/lang/java.nice,v retrieving revision 1.23 retrieving revision 1.24 diff -C2 -d -r1.23 -r1.24 *** java.nice 16 May 2003 00:18:11 -0000 1.23 --- java.nice 21 Jun 2003 09:05:28 -0000 1.24 *************** *** 180,181 **** --- 180,184 ---- class StringTokenizer = native java.util.StringTokenizer; + + <T> void update(Observer, Observable, T) = + native void Observer.update(Observable, Object); |
From: <bo...@us...> - 2003-06-21 09:03:58
|
Update of /cvsroot/nice/Nice/debian In directory sc8-pr-cvs1:/tmp/cvs-serv11744/debian Modified Files: changelog Log Message: We should avoid speaking about "enhanced foo" in the changelog because: 1) Of course it's better! ;-) 2) What people what to know is what is new or different. Index: changelog =================================================================== RCS file: /cvsroot/nice/Nice/debian/changelog,v retrieving revision 1.181 retrieving revision 1.182 diff -C2 -d -r1.181 -r1.182 *** changelog 20 Jun 2003 11:10:05 -0000 1.181 --- changelog 21 Jun 2003 09:03:55 -0000 1.182 *************** *** 31,36 **** * Method bodies with a single statement can be written without brackets. example: void foo() = throw new Exception; ! * Implemented the enhanced syntax for tuples in function declarations: ! String foo((String s, String t)) = s+t; It also works for anonymous functions: List<(String, int)> tuples = new ArrayList(); --- 31,36 ---- * Method bodies with a single statement can be written without brackets. example: void foo() = throw new Exception; ! * It is possible to bind the values of tuple arguments to functions: ! String foo((String s, String t)) = s + t; It also works for anonymous functions: List<(String, int)> tuples = new ArrayList(); |
From: <ar...@us...> - 2003-06-20 11:10:08
|
Update of /cvsroot/nice/Nice/debian In directory sc8-pr-cvs1:/tmp/cvs-serv32034/F:/nice/debian Modified Files: changelog Log Message: update changelog about enums. Index: changelog =================================================================== RCS file: /cvsroot/nice/Nice/debian/changelog,v retrieving revision 1.180 retrieving revision 1.181 diff -C2 -d -r1.180 -r1.181 *** changelog 16 Jun 2003 20:40:36 -0000 1.180 --- changelog 20 Jun 2003 11:10:05 -0000 1.181 *************** *** 38,41 **** --- 38,48 ---- tuples.foreach(((String name, int number)) => println("name: "+name+" number: "+number) ); + * Implemented simple enums. The above color example can be simplified to: + enum Color { red, blue, green } + String name(Color); + name(=red) = "red"; + name(=blue) = "blue"; + name(=green) = "green"; + The compiler knows now that the method "name" is completely covered. * Bugfixes (Parsing of nested tuples, global constants of type char, Overloading resolving of methods implementation with additional tc's, ...) |
From: <bo...@us...> - 2003-06-20 10:05:44
|
Update of /cvsroot/nice/Nice/web In directory sc8-pr-cvs1:/tmp/cvs-serv23733/web Modified Files: new.xsl Log Message: Specify the size of the icons, so the pages can be rendered better while they are loading. Index: new.xsl =================================================================== RCS file: /cvsroot/nice/Nice/web/new.xsl,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** new.xsl 16 Jun 2003 18:52:54 -0000 1.10 --- new.xsl 20 Jun 2003 10:05:41 -0000 1.11 *************** *** 73,77 **** <table border="0" cellpadding="3" cellspacing="1" width="100%"> <tr> ! <td bgcolor="#cccccc"><img align="middle" src="images/doc-48.png" alt="."/> <span class="title">Documentation</span> </td> --- 73,77 ---- <table border="0" cellpadding="3" cellspacing="1" width="100%"> <tr> ! <td bgcolor="#cccccc"><img width="48" height="48" align="middle" src="images/doc-48.png" alt="."/> <span class="title">Documentation</span> </td> *************** *** 109,113 **** <table border="0" cellpadding="3" cellspacing="1" width="100%"> <tr> ! <td bgcolor="#cccccc"><img align="middle" src="images/floppy-48.png" alt="."/> <span class="title"><a href="install.html">Download</a></span> </td> --- 109,113 ---- <table border="0" cellpadding="3" cellspacing="1" width="100%"> <tr> ! <td bgcolor="#cccccc"><img width="48" height="48" align="middle" src="images/floppy-48.png" alt="."/> <span class="title"><a href="install.html">Download</a></span> </td> *************** *** 126,130 **** <table border="0" cellpadding="3" cellspacing="1" width="100%"> <tr> ! <td bgcolor="#cccccc"><img align="middle" src="images/envelope-48.png" alt="."/> <span class="title">User's corner</span> </td> --- 126,130 ---- <table border="0" cellpadding="3" cellspacing="1" width="100%"> <tr> ! <td bgcolor="#cccccc"><img width="48" height="48" align="middle" src="images/envelope-48.png" alt="."/> <span class="title">User's corner</span> </td> *************** *** 209,213 **** <table border="0" cellpadding="3" cellspacing="1" width="100%"> <tr> ! <td bgcolor="#cccccc"><img align="middle" src="images/academic-48.png" alt="."/> <span class="title"><a href="research.html">Academic Research</a></span> </td> --- 209,213 ---- <table border="0" cellpadding="3" cellspacing="1" width="100%"> <tr> ! <td bgcolor="#cccccc"><img width="48" height="48" align="middle" src="images/academic-48.png" alt="."/> <span class="title"><a href="research.html">Academic Research</a></span> </td> |
From: <bo...@us...> - 2003-06-19 21:10:01
|
Update of /cvsroot/nice/Nice/web In directory sc8-pr-cvs1:/tmp/cvs-serv24596/web Modified Files: manual.xml Log Message: Use System.out.println in Java, not println. Make advantage of the import in the Nice-from-Java example. Typos. Index: manual.xml =================================================================== RCS file: /cvsroot/nice/Nice/web/manual.xml,v retrieving revision 1.25 retrieving revision 1.26 diff -C2 -d -r1.25 -r1.26 *** manual.xml 19 Jun 2003 20:32:50 -0000 1.25 --- manual.xml 19 Jun 2003 21:09:59 -0000 1.26 *************** *** 110,114 **** <para> Note that this is somewhat different from Java packages. ! In Java, a class can be used independantly of its declaring package. In Nice methods can be declared outside classes, so importing the whole package is important to know the methods available for a --- 110,114 ---- <para> Note that this is somewhat different from Java packages. ! In Java, a class can be used independently of its declaring package. In Nice methods can be declared outside classes, so importing the whole package is important to know the methods available for a *************** *** 360,364 **** <literal>:</literal> before the value given to that parameter. Named parameters can be given in any order. ! This is useful when writting the call, because one does not need to remember the order of the arguments, but only their names. When reading the code, it is much easier to understand --- 360,364 ---- <literal>:</literal> before the value given to that parameter. Named parameters can be given in any order. ! This is useful when writing the call, because one does not need to remember the order of the arguments, but only their names. When reading the code, it is much easier to understand *************** *** 883,887 **** <section><title>Tuples</title> <para> ! A tuple is a groupment of several values in a single expression. For instance, <literal>("Hello", 2*3, x.toString())</literal> is a tuple whose elements are the string <literal>"Hello"</literal>, --- 883,887 ---- <section><title>Tuples</title> <para> ! A tuple is a grouping of several values in a single expression. For instance, <literal>("Hello", 2*3, x.toString())</literal> is a tuple whose elements are the string <literal>"Hello"</literal>, *************** *** 1004,1008 **** <type>int</type> but incomparable with <type>short</type>. Conversion from a smaller to a larger type is automatic. ! Conversion from a larger to a smaller type must be done explicitely, since they can lose information about the magnitude of the value. </para> --- 1004,1008 ---- <type>int</type> but incomparable with <type>short</type>. Conversion from a smaller to a larger type is automatic. ! Conversion from a larger to a smaller type must be done explicitly, since they can lose information about the magnitude of the value. </para> *************** *** 1089,1093 **** Since Java allows the value to be &NULL;, the Nice compiler ! currently suposes it's <type>?String</type> (it can only be sure about primitive types like <type>int</type>). </para> --- 1089,1093 ---- Since Java allows the value to be &NULL;, the Nice compiler ! currently supposes it's <type>?String</type> (it can only be sure about primitive types like <type>int</type>). </para> *************** *** 1233,1240 **** Worker w = new Worker("Julia", 1000); ! println(my.nice.pkg.dispatch.display(p)); ! println(my.nice.pkg.dispatch.display(w)); ! if (my.nice.pkg.fun.isRich(w)) ! println("A well paid worker!"); } } --- 1233,1240 ---- Worker w = new Worker("Julia", 1000); ! System.out.println(dispatch.display(p)); ! System.out.println(dispatch.display(w)); ! if (fun.isRich(w)) ! System.out.println("A well paid worker!"); } } *************** *** 1341,1345 **** is none, a solution is to use <literal>cast(null)</literal>. This expression will be accepted in any context. ! It is then your responsability to make sure that this value is not used. </para> --- 1341,1345 ---- is none, a solution is to use <literal>cast(null)</literal>. This expression will be accepted in any context. ! It is then your responsibility to make sure that this value is not used. </para> |
From: <bo...@us...> - 2003-06-19 20:32:54
|
Update of /cvsroot/nice/Nice/web In directory sc8-pr-cvs1:/tmp/cvs-serv17044/web Modified Files: manual.xml Log Message: Clarified assertion error messages, and a typo. Index: manual.xml =================================================================== RCS file: /cvsroot/nice/Nice/web/manual.xml,v retrieving revision 1.24 retrieving revision 1.25 diff -C2 -d -r1.24 -r1.25 *** manual.xml 17 Jun 2003 13:00:30 -0000 1.24 --- manual.xml 19 Jun 2003 20:32:50 -0000 1.25 *************** *** 676,682 **** void add(Elem element) requires ! !isfull() : "not full" // A comma here is optional ensures ! !isEmpty() : "not empty", // Note the comma size() == old(size()) + 1 : "count inc"; }]]></programlisting> --- 676,682 ---- void add(Elem element) requires ! !isfull() : "buffer must not be not full" // A comma here is optional ensures ! !isEmpty() : "buffer must not be empty", // Note the comma size() == old(size()) + 1 : "count inc"; }]]></programlisting> *************** *** 1260,1264 **** <para> Fields of Nice classes are accessed normally from Java programs. ! It is possible to declare a Java subclass of a Java class. The constructor will need to call the <link linkend="constructorFromJava">parent constructor</link>. --- 1260,1264 ---- <para> Fields of Nice classes are accessed normally from Java programs. ! It is possible to declare a Java subclass of a Nice class. The constructor will need to call the <link linkend="constructorFromJava">parent constructor</link>. |