nice-commit Mailing List for The Nice Programming Language (Page 54)
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: <ar...@us...> - 2004-02-27 18:41:01
|
Update of /cvsroot/nice/swing/src/nice/ui/common/types/awt In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv12429/D:/nice/nice/ui/common/types/awt Modified Files: java.nice Log Message: Syntax update for niceswing (new pattern style, removed Any keyword). Index: java.nice =================================================================== RCS file: /cvsroot/nice/swing/src/nice/ui/common/types/awt/java.nice,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** java.nice 25 Jan 2004 00:19:54 -0000 1.6 --- java.nice 27 Feb 2004 18:32:08 -0000 1.7 *************** *** 250,254 **** // interface Composite ! <Any Key, Any Element> CompositeContext createContext(Composite, ColorModel, ColorModel, RenderingHints<Key,Element>) = native CompositeContext Composite.createContext(ColorModel, ColorModel, RenderingHints) ; --- 250,254 ---- // interface Composite ! <Key, Element> CompositeContext createContext(Composite, ColorModel, ColorModel, RenderingHints<Key,Element>) = native CompositeContext Composite.createContext(ColorModel, ColorModel, RenderingHints) ; *************** *** 300,304 **** // interface Paint ! <Any Key, Element> PaintContext createContext(Paint, ColorModel, Rectangle, Rectangle2D, AffineTransform, RenderingHints<Key,Element>) = native PaintContext Paint.createContext(ColorModel, Rectangle, Rectangle2D, AffineTransform, RenderingHints); --- 300,304 ---- // interface Paint ! <Key, Element> PaintContext createContext(Paint, ColorModel, Rectangle, Rectangle2D, AffineTransform, RenderingHints<Key,Element>) = native PaintContext Paint.createContext(ColorModel, Rectangle, Rectangle2D, AffineTransform, RenderingHints); *************** *** 691,695 **** //JDK1.4 void firePropertyChange(Component, String, int, int) //JDK1.4 = native void Component.firePropertyChange(String, int, int); ! //JDK1.4 <Any Key, Any Element> void setFocusTraversalKeys(Component, int, Set<Key,Element>) //JDK1.4 = native void Component.setFocusTraversalKeys(int, Set); //JDK1.4 PropertyChangeListener[] getPropertyChangeListeners(Component) --- 691,695 ---- //JDK1.4 void firePropertyChange(Component, String, int, int) //JDK1.4 = native void Component.firePropertyChange(String, int, int); ! //JDK1.4 <Key, Element> void setFocusTraversalKeys(Component, int, Set<Key,Element>) //JDK1.4 = native void Component.setFocusTraversalKeys(int, Set); //JDK1.4 PropertyChangeListener[] getPropertyChangeListeners(Component) *************** *** 822,826 **** Font decode(String) = native Font Font.decode(String); ! <Any Key, Any Element> Font getFont(Map<Key,Element>) = native Font Font.getFont(Map); Font getFont(String, Font) --- 822,826 ---- Font decode(String) = native Font Font.decode(String); ! <Key, Element> Font getFont(Map<Key,Element>) = native Font Font.getFont(Map); Font getFont(String, Font) *************** *** 847,853 **** Font deriveFont(Font, int, float) = native Font Font.deriveFont(int, float); ! <Any Key, Any Element> Font deriveFont(Font, Map<Key,Element>) = native Font Font.deriveFont(Map); ! <Any Key, Any Element> Map<Key,Element> getAttributes(Font) = native Map Font.getAttributes(); String getFamily(Font) --- 847,853 ---- Font deriveFont(Font, int, float) = native Font Font.deriveFont(int, float); ! <Key, Element> Font deriveFont(Font, Map<Key,Element>) = native Font Font.deriveFont(Map); ! <Key, Element> Map<Key,Element> getAttributes(Font) = native Map Font.getAttributes(); String getFamily(Font) *************** *** 957,961 **** Paint getPaint(Graphics2D) = native Paint Graphics2D.getPaint(); ! <Any Key, Any Element> RenderingHints<Key,Element> getRenderingHints(Graphics2D) = native RenderingHints Graphics2D.getRenderingHints(); Stroke getStroke(Graphics2D) = --- 957,961 ---- Paint getPaint(Graphics2D) = native Paint Graphics2D.getPaint(); ! <Key, Element> RenderingHints<Key,Element> getRenderingHints(Graphics2D) = native RenderingHints Graphics2D.getRenderingHints(); Stroke getStroke(Graphics2D) = *************** *** 1081,1085 **** void setHelpMenu(MenuBar, Menu) = native void MenuBar.setHelpMenu(Menu); ! <Any Element> Enumeration<Element> shortcuts(MenuBar) = native Enumeration MenuBar.shortcuts(); --- 1081,1085 ---- void setHelpMenu(MenuBar, Menu) = native void MenuBar.setHelpMenu(Menu); ! <Element> Enumeration<Element> shortcuts(MenuBar) = native Enumeration MenuBar.shortcuts(); |
From: <bo...@us...> - 2004-02-27 17:48:22
|
Update of /cvsroot/nice/Nice/stdlib/nice/lang In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv1694/stdlib/nice/lang Modified Files: strings.nice Log Message: Modified split to use a character separator. JDK 1.4 includes a String.split(String), where the second argument is a regexp. It's not necessary to duplicate that functionality, but spliting based on a single character is a useful special case. Index: strings.nice =================================================================== RCS file: /cvsroot/nice/Nice/stdlib/nice/lang/strings.nice,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -d -r1.14 -r1.15 *** strings.nice 19 Nov 2003 16:04:45 -0000 1.14 --- strings.nice 27 Feb 2004 17:39:30 -0000 1.15 *************** *** 69,75 **** * @param str the string to split * @param separator the separator to split on ! */ ! List<String> split(String str, String separator) ! requires separator.length() > 0 : "separator cannot be the empty string" { List<String> res = new ArrayList(); --- 69,74 ---- * @param str the string to split * @param separator the separator to split on ! */ ! List<String> split(String str, char separator) { List<String> res = new ArrayList(); *************** *** 85,89 **** res.add(str.substring(pos, ntx)); } ! pos = ntx + separator.length; } else --- 84,88 ---- res.add(str.substring(pos, ntx)); } ! pos = ntx + 1; } else |
From: <bo...@us...> - 2004-02-27 15:40:46
|
Update of /cvsroot/nice/Nice/web In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv6231/web Modified Files: .htaccess Log Message: Released 0.9.6 Index: .htaccess =================================================================== RCS file: /cvsroot/nice/Nice/web/.htaccess,v retrieving revision 1.16 retrieving revision 1.17 diff -C2 -d -r1.16 -r1.17 *** .htaccess 26 Jan 2004 12:54:53 -0000 1.16 --- .htaccess 27 Feb 2004 15:31:58 -0000 1.17 *************** *** 1,6 **** Redirect /Wiki http://nice.sourceforge.net/cgi-bin/twiki/view ! Redirect /Nice.tar http://prdownloads.sourceforge.net/nice/Nice-0.9.5-unix.tar.gz ! Redirect /Nice-source.tar.gz http://prdownloads.sourceforge.net/nice/Nice-0.9.5-source.tar.gz ! Redirect /Nice.zip http://prdownloads.sourceforge.net/nice/Nice-0.9.5-windows.zip ! Redirect /nice.deb http://prdownloads.sourceforge.net/nice/nice_0.9.5-1_all.deb ! Redirect /nice.rpm http://prdownloads.sourceforge.net/nice/Nice-0.9.5-1.noarch.rpm --- 1,6 ---- Redirect /Wiki http://nice.sourceforge.net/cgi-bin/twiki/view ! Redirect /Nice.tar http://prdownloads.sourceforge.net/nice/Nice-0.9.6-unix.tar.gz ! Redirect /Nice-source.tar.gz http://prdownloads.sourceforge.net/nice/Nice-0.9.6-source.tar.gz ! Redirect /Nice.zip http://prdownloads.sourceforge.net/nice/Nice-0.9.6-windows.zip ! Redirect /nice.deb http://prdownloads.sourceforge.net/nice/nice_0.9.6-1_all.deb ! Redirect /nice.rpm http://prdownloads.sourceforge.net/nice/Nice-0.9.6-1.noarch.rpm |
From: <bo...@us...> - 2004-02-27 15:38:39
|
Update of /cvsroot/nice/Nice/stdlib/nice/lang In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv5836/stdlib/nice/lang Modified Files: collections.nice Log Message: Corrected nicedoc comment for filter. Index: collections.nice =================================================================== RCS file: /cvsroot/nice/Nice/stdlib/nice/lang/collections.nice,v retrieving revision 1.60 retrieving revision 1.61 diff -C2 -d -r1.60 -r1.61 *** collections.nice 24 Feb 2004 16:04:56 -0000 1.60 --- collections.nice 27 Feb 2004 15:29:52 -0000 1.61 *************** *** 36,44 **** <Collection C, T> C<T> filter(C<T>, T->boolean); ! /** Return a collection containing all elements for which converter returns a non-null value. - It is possible to retain only elemnts with a subtype of the original - element type, in which case the returned collection has that - element type. */ <Collection C, T, U> C<!U> filter(C<T> source, T->?U converter) --- 36,41 ---- <Collection C, T> C<T> filter(C<T>, T->boolean); ! /** Return a collection containing all the elements for which converter returns a non-null value. */ <Collection C, T, U> C<!U> filter(C<T> source, T->?U converter) |
From: <bo...@us...> - 2004-02-27 01:39:19
|
Update of /cvsroot/nice/Nice/web In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv21417/web Modified Files: manual.xml Log Message: Minor: conform to docbook. Index: manual.xml =================================================================== RCS file: /cvsroot/nice/Nice/web/manual.xml,v retrieving revision 1.37 retrieving revision 1.38 diff -C2 -d -r1.37 -r1.38 *** manual.xml 25 Feb 2004 18:12:06 -0000 1.37 --- manual.xml 27 Feb 2004 01:30:58 -0000 1.38 *************** *** 508,512 **** constants with special meanings. For instance, one might write a method for a vending machine: ! <programlisting language="nice"> let int NICKEL = 5; let int DIME = 10; --- 508,512 ---- constants with special meanings. For instance, one might write a method for a vending machine: ! <programlisting lang="nice"> let int NICKEL = 5; let int DIME = 10; *************** *** 529,533 **** it is not. However, there is an easier solution in Nice: the enum. <programlisting> ! enum <type><replaceable>class-name</replaceable></type><optional>(<replaceable><type>parameter-type</type></replaceable><replaceable>parameter-name</replaceable>, ...)</optional> { <replaceable>option,...</replaceable> --- 529,533 ---- it is not. However, there is an easier solution in Nice: the enum. <programlisting> ! enum <type><replaceable>class-name</replaceable></type><optional>(<type><replaceable>parameter-type</replaceable></type> <replaceable>parameter-name</replaceable>, ...)</optional> { <replaceable>option,...</replaceable> *************** *** 535,543 **** </programlisting> Enums can be simple symbols like ! <programlisting language="nice"> enum Color { Red, Orange, Yellow, Blue, Indigo, Violet } </programlisting> or they can contain integer (or other) values: ! <programlisting language="nice"> enum VendingCoin(int value) { --- 535,543 ---- </programlisting> Enums can be simple symbols like ! <programlisting lang="nice"> enum Color { Red, Orange, Yellow, Blue, Indigo, Violet } </programlisting> or they can contain integer (or other) values: ! <programlisting lang="nice"> enum VendingCoin(int value) { *************** *** 1178,1182 **** <replaceable>T</replaceable></type></literal>: </para> ! <programlisting language="nice"> <replaceable>method-name</replaceable>(<replaceable>argument</replaceable>, ...) { --- 1178,1182 ---- <replaceable>T</replaceable></type></literal>: </para> ! <programlisting lang="nice"> <replaceable>method-name</replaceable>(<replaceable>argument</replaceable>, ...) { |
From: <bo...@us...> - 2004-02-27 01:34:17
|
Update of /cvsroot/nice/Nice/src/nice/tools/typing In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv20231/src/nice/tools/typing Modified Files: Types.java Log Message: Minor: conform to docbook. |
From: <bo...@us...> - 2004-02-26 22:26:22
|
Update of /cvsroot/nice/Nice/src/nice/tools/typing In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv12507/src/nice/tools/typing Modified Files: Types.java Log Message: Changed mlsub.typing.Domain so that it contains an array of monotypes instead of a single monotype (which was normally a tuple type). This is more consistent with function types having an array of parameters, more efficient, and it allows for simpler handling of the components of the domain. Index: Types.java =================================================================== RCS file: /cvsroot/nice/Nice/src/nice/tools/typing/Types.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** Types.java 25 Feb 2004 11:23:28 -0000 1.1 --- Types.java 26 Feb 2004 22:17:36 -0000 1.2 *************** *** 172,176 **** Monotype[] m = parameters(t.getMonotype()); ! return new Domain(t.getConstraint(), new TupleType(m)); } } --- 172,176 ---- Monotype[] m = parameters(t.getMonotype()); ! return new Domain(t.getConstraint(), m); } } |
From: <bo...@us...> - 2004-02-26 22:25:54
|
Update of /cvsroot/nice/Nice/src/bossa/syntax In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv12507/src/bossa/syntax Modified Files: OverloadedSymbolExp.java CallExp.java Log Message: Changed mlsub.typing.Domain so that it contains an array of monotypes instead of a single monotype (which was normally a tuple type). This is more consistent with function types having an array of parameters, more efficient, and it allows for simpler handling of the components of the domain. Index: OverloadedSymbolExp.java =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/syntax/OverloadedSymbolExp.java,v retrieving revision 1.67 retrieving revision 1.68 diff -C2 -d -r1.67 -r1.68 *** OverloadedSymbolExp.java 25 Feb 2004 11:23:28 -0000 1.67 --- OverloadedSymbolExp.java 26 Feb 2004 22:17:39 -0000 1.68 *************** *** 520,524 **** } ! return new Domain(t.getConstraint(), new TupleType(dom)); } --- 520,524 ---- } ! return new Domain(t.getConstraint(), dom); } Index: CallExp.java =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/syntax/CallExp.java,v retrieving revision 1.91 retrieving revision 1.92 diff -C2 -d -r1.91 -r1.92 *** CallExp.java 25 Feb 2004 11:23:29 -0000 1.91 --- CallExp.java 26 Feb 2004 22:17:39 -0000 1.92 *************** *** 223,227 **** } ! Typing.in(parameters, Domain.fromMonotypes(dom)); } finally{ --- 223,227 ---- } ! Typing.in(parameters, dom); } finally{ |
From: <bo...@us...> - 2004-02-26 22:25:54
|
Update of /cvsroot/nice/Nice/src/mlsub/typing In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv12507/src/mlsub/typing Modified Files: Typing.java Polytype.java Domain.java Log Message: Changed mlsub.typing.Domain so that it contains an array of monotypes instead of a single monotype (which was normally a tuple type). This is more consistent with function types having an array of parameters, more efficient, and it allows for simpler handling of the components of the domain. Index: Typing.java =================================================================== RCS file: /cvsroot/nice/Nice/src/mlsub/typing/Typing.java,v retrieving revision 1.33 retrieving revision 1.34 diff -C2 -d -r1.33 -r1.34 *** Typing.java 15 Jan 2004 12:09:53 -0000 1.33 --- Typing.java 26 Feb 2004 22:17:37 -0000 1.34 *************** *** 328,331 **** --- 328,338 ---- } + public static void leq(Monotype[] ms1, Monotype[] ms2) + throws TypingEx + { + for(int i = 0; i < ms1.length; i++) + leq(ms1[i], ms2[i]); + } + /**************************************************************** * Type constructors *************** *** 389,393 **** Constraint.hasBinders(d2.getConstraint()))) { ! leq(d1.getMonotype(), d2.getMonotype()); return; } --- 396,400 ---- Constraint.hasBinders(d2.getConstraint()))) { ! leq(d1.getMonotypes(), d2.getMonotypes()); return; } *************** *** 400,404 **** Constraint.enter(d2.getConstraint()); ! leq(d1.getMonotype(), d2.getMonotype()); } finally{ --- 407,411 ---- Constraint.enter(d2.getConstraint()); ! leq(d1.getMonotypes(), d2.getMonotypes()); } finally{ *************** *** 408,435 **** /** Test if a polytype is in a domain. */ ! public static void in(Polytype type, Domain domain) throws TypingEx { ! if(dbg) Debug.println(type+" in "+domain); ! ! if(domain == Domain.bot) ! return; Constraint.enter(type.getConstraint()); ! Constraint.enter(domain.getConstraint()); ! leq(type.getMonotype(),domain.getMonotype()); ! } ! ! /** Test if a monotype is in a domain. */ ! public static void in(Monotype type, Domain domain) ! throws TypingEx ! { ! if(dbg) Debug.println(type+" in "+domain); ! ! if(domain == Domain.bot) ! return; ! ! Constraint.enter(domain.getConstraint()); ! leq(type, domain.getMonotype()); } --- 415,425 ---- /** Test if a polytype is in a domain. */ ! public static void in(Polytype type, Monotype domain) throws TypingEx { ! if(dbg) Debug.println(type + " in " + domain); Constraint.enter(type.getConstraint()); ! leq(type.getMonotype(), domain); } *************** *** 438,467 **** * * @param types a collection of Polytypes ! * @param domains a collection of Domains * @exception TypingEx */ public static void in(Polytype[] types, ! Domain[] domains) ! throws TypingEx ! { ! int expected = domains.length; ! int actual = types.length; ! if(expected != actual) ! throw new BadSizeEx(expected, actual); ! ! for(int i = 0; i<actual; i++) ! in(types[i], domains[i]); ! } ! ! /** ! * Checks wether monotypes belong to domains. ! * This is just the special case where all polytypes are monomorphic. ! * ! * @param types a collection of Monotypes ! * @param domains a collection of Domains ! * @exception TypingEx ! */ ! public static void in(Monotype[] types, ! Domain[] domains) throws TypingEx { --- 428,436 ---- * * @param types a collection of Polytypes ! * @param domains a collection of domains * @exception TypingEx */ public static void in(Polytype[] types, ! Monotype[] domains) throws TypingEx { Index: Polytype.java =================================================================== RCS file: /cvsroot/nice/Nice/src/mlsub/typing/Polytype.java,v retrieving revision 1.21 retrieving revision 1.22 diff -C2 -d -r1.21 -r1.22 *** Polytype.java 2 Feb 2004 17:25:26 -0000 1.21 --- Polytype.java 26 Feb 2004 22:17:39 -0000 1.22 *************** *** 11,18 **** /**************************************************************************/ - // File : Domain.java - // Created : Fri Jun 02 16:59:06 2000 by Daniel Bonniot - //$Modified: Thu Aug 31 18:17:47 2000 by Daniel Bonniot $ - package mlsub.typing; --- 11,14 ---- *************** *** 237,241 **** throw new InternalError("getDomain on non functional polytype "+this); ! return new Domain(constraint, new TupleType(domains)); } --- 233,237 ---- throw new InternalError("getDomain on non functional polytype "+this); ! return new Domain(constraint, domains); } Index: Domain.java =================================================================== RCS file: /cvsroot/nice/Nice/src/mlsub/typing/Domain.java,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** Domain.java 6 Sep 2000 12:38:27 -0000 1.6 --- Domain.java 26 Feb 2004 22:17:39 -0000 1.7 *************** *** 24,31 **** public class Domain { ! public Domain(Constraint constraint, Monotype monotype) { this.constraint = constraint; ! this.monotype = monotype; } --- 24,31 ---- public class Domain { ! public Domain(Constraint constraint, Monotype[] monotypes) { this.constraint = constraint; ! this.monotypes = monotypes; } *************** *** 40,56 **** } ! public Monotype getMonotype() ! { ! return monotype; ! } ! ! public static Domain[] fromMonotypes(Monotype[] monotypes) { ! Domain[] res = new Domain[monotypes.length]; ! for(int i=0; i<monotypes.length; i++) ! res[i] = new Domain(Constraint.True, monotypes[i]); ! return res; } ! /**************************************************************** * Misc --- 40,48 ---- } ! public Monotype[] getMonotypes() { ! return monotypes; } ! /**************************************************************** * Misc *************** *** 59,66 **** public String toString() { ! return (constraint==null ? "" : "Ex "+constraint) + monotype.toString(); } private Constraint constraint; ! private Monotype monotype; } --- 51,59 ---- public String toString() { ! return (constraint == null ? "" : "Ex " + constraint) + ! java.util.Arrays.asList(monotypes).toString(); } private Constraint constraint; ! private Monotype[] monotypes; } |
From: <ar...@us...> - 2004-02-26 13:05:33
|
Update of /cvsroot/nice/Nice/src/bossa/syntax In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv19206/F:/nice/src/bossa/syntax Modified Files: RetypedJavaMethod.java Log Message: Removed return type check of retypings because of bug #904832. Index: RetypedJavaMethod.java =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/syntax/RetypedJavaMethod.java,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -d -r1.14 -r1.15 *** RetypedJavaMethod.java 24 Feb 2004 14:05:47 -0000 1.14 --- RetypedJavaMethod.java 26 Feb 2004 12:57:24 -0000 1.15 *************** *** 187,198 **** //reflectMethod.return_type = javaRetType; - if (! reflectMethod.isConstructor() && - ! reflectMethod.return_type.getName().equals(javaRetType.getName())) - User.error(retTypeString, - "Method " + methodName + - " has not the indicated return type." + - "\nIndicated: " + javaRetType.getName() + - "\nFound : " + reflectMethod.return_type.getName()); - if (reflectMethod.isConstructor()) { --- 187,190 ---- |
From: <xo...@us...> - 2004-02-25 18:19:29
|
Update of /cvsroot/nice/Nice/web In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv17591/web Modified Files: manual.xml Log Message: Manual updates for 0.9.6 -Custom constructors -Initializers -Enums -Main method should be outside of a class -Block call syntax -No nullness inference on fields -Typos, etc. Index: manual.xml =================================================================== RCS file: /cvsroot/nice/Nice/web/manual.xml,v retrieving revision 1.36 retrieving revision 1.37 diff -C2 -d -r1.36 -r1.37 *** manual.xml 7 Feb 2004 13:42:42 -0000 1.36 --- manual.xml 25 Feb 2004 18:12:06 -0000 1.37 *************** *** 135,138 **** --- 135,154 ---- for details. </para> + <section id="mainMethod"><title>The <literal>main</literal> method</title> + <para> + If a package contains a method whose name is <literal>main</literal> + and the method has a <literal>void</literal> return type and takes + a single <literal>String[]</literal> as its argument, this method + receives special treatment, in that when the program is run, execution + will begin with this <literal>main</literal> method. The runtime + system will pass the command line arguments used to invoke the program + as the argument to <literal>main</literal>. + </para> + <para> + Note that since the main unit of code in Nice is the package, + and not the class, the <literal>main</literal> method should + be implemented outside of any class declaration. + </para> + </section> </chapter> *************** *** 163,177 **** <section id="constructor"><title>Constructors</title> <para> ! There is no way to define a constructor in Nice. The reason is that ! in languages that support them, most constructors just take ! as parameters the initial values for the fields and assign them ! to the new object. This simple but tedious task has to be done ! by the programmer for each class definition. ! In Nice, such a constructor is generated automatically by the compiler. ! It is called the automatic constructor. ! It takes the names of the fields as named arguments, ! and those who have an initial value are optional. ! The constructor is called <literal>new</literal> followed by ! the name of the class to create. </para> --- 179,192 ---- <section id="constructor"><title>Constructors</title> <para> ! Classes in Nice have a default (or "automatic") constructor ! which is generated ! automatically by the compiler. This constructor allows all the ! fields of the class to be specified explicitly, though if the ! field has a default value in the class definition, it can be ! omitted from the constructor call and the default value will ! be used. In many cases this default constructor is all that ! is needed, and it saves the programmer from having to write ! tedious code that simply accepts values and assigns them to ! fields. </para> *************** *** 220,230 **** <para> ! If a behaviour different than that of the automatic constructor is ! needed, it is possible to define ! a creation <link linkend="method">method</link> that can perform ! the task, calling the constructor to create the object and ! initialize the fields. ! This method should by convention be called <literal>create</literal> ! suffixed by the name of the class to create. </para> </section> --- 235,334 ---- <para> ! When more control over construction is desired, it is possible ! to write new constructors that can be used in place of the ! automatic constructor. These are written much like any other ! method, but they use a slightly different declaration syntax: ! <programlisting> ! new <type><replaceable>class-name</replaceable></type>(<type><replaceable>param-type</replaceable></type><replaceable>param-name</replaceable><optional> = <replaceable>initial-value</replaceable></optional>, ...) ! { ! <replaceable>method-body</replaceable>; ! this(<replaceable>argument</replaceable>, ...); ! } ! </programlisting> ! This syntax requires that the last statement in any custom ! constructor calls some other constructor for the same type. ! In most cases, the automatic constructor will be called. ! </para> ! <example><title>Class definition and creations using custom constructors</title> ! <programlisting lang="nice"><![CDATA[ ! /** ! * Class which encapsulates a strategy for ! * way of translating a character. ! */ ! class Translator ! { ! //The function that actually performs the translation ! char->char transFunction; ! ! //convenience method ! char translate(char input) ! { ! return (this.transFunction)(input); ! } ! } ! ! /** ! * Constructor which takes a map of characters, and ! * returns a Translator which looks up the input ! * character in the map, or just returns the input ! * character if it's not in the map. ! */ ! new Translator(Map<char,char> characters) ! { ! this(transFunction: char c => characters.get(c) || c); ! } ! ! ! ! ! //A translator which provides rot13 ciphering. ! //Uses automatic constructor. ! var Translator rot13 = new Translator(transFunction: ! char c => char(int(c) + 13)); ! ! //A translator which just changes 's' or 'S' to '$'. ! //Uses custom constructor. ! var Translator sToDollar = new Translator(characters: listToMap([ ! ('s', '$'), ! ('S', '$') ! ])); ! ]]></programlisting> ! </example> ! <para> ! It is also possible to define <firstterm>initializers</firstterm> ! for your classes. An initializer is simply a block of code that ! executes after construction is finished. To define an initializer, ! simply include code directly in the class definition, inside ! a block: ! <programlisting> ! class <type><replaceable>class-name</replaceable></type> ! { ! { ! <replaceable>initializer</replaceable> ! } ! <replaceable>fields-and-methods</replaceable> ! } ! </programlisting> ! </para> ! <para> ! Here is an example. Notice that since the initializer runs ! after any constructors, the hidden counter field will always ! be set to zero, even if the caller had tried to set it to ! some other value when the object was created. ! <example><title>Class initializers</title> ! <programlisting lang="nice"><![CDATA[ ! class Counter ! { ! ! { ! this._internal_counter = 0; ! } ! ! int _internal_counter = 0; ! } ! ! ]]></programlisting> ! </example> ! </para> </section> *************** *** 367,371 **** in this style: <example> ! <title>Declaring an Interface with Multi-Methods</title> <programlisting lang="nice"> interface Component {} --- 471,475 ---- in this style: <example> ! <title>Declaring an Interface with External Methods</title> <programlisting lang="nice"> interface Component {} *************** *** 396,399 **** --- 500,564 ---- </para> </section> + <section id="enums"><title>Enumerations</title> + <para> + Enumerations or simply (<literal>enum</literal>s) are a group + of related constants. Many languages support defining simple + constants, and of course <link linkend="constants">Nice does + also</link>. Many programs are written to use certain numeric + constants with special meanings. For instance, one might + write a method for a vending machine: + <programlisting language="nice"> + let int NICKEL = 5; + let int DIME = 10; + let int QUARTER = 25; + + class VendingMachine + { + int change = 0; + } + + void addCoin(VendingMachine machine, int cents) + { + machine.change += cents; + } + </programlisting> + but this method isn't very safe! It will accept any amount of + change, including nonsensical amounts like 3, or 234320. One + way to address this problem would be to do runtime checks to + ensure that the value is acceptable, and throw an exception if + it is not. However, there is an easier solution in Nice: the enum. + <programlisting> + enum <type><replaceable>class-name</replaceable></type><optional>(<replaceable><type>parameter-type</type></replaceable><replaceable>parameter-name</replaceable>, ...)</optional> + { + <replaceable>option,...</replaceable> + } + </programlisting> + Enums can be simple symbols like + <programlisting language="nice"> + enum Color { Red, Orange, Yellow, Blue, Indigo, Violet } + </programlisting> + or they can contain integer (or other) values: + <programlisting language="nice"> + enum VendingCoin(int value) + { + nickel(5), dime(10), quarter(25); + } + + class VendingMachine + { + int change = 0; + } + + void addCoin(VendingMachine machine, VendingCoin cents) + { + machine.change += cents.value; + } + </programlisting> + Of course, a realistic vending machine would have to keep track of + the actual number of each coin rather than a total value! + </para> + + + </section> </chapter> *************** *** 852,856 **** </literal> </para> ! <para> Constants are declared with "let": </para> --- 1017,1021 ---- </literal> </para> ! <para id="constants"> Constants are declared with "let": </para> *************** *** 862,866 **** </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 --- 1027,1031 ---- </literal> </para> ! <para id="monomorphicLet"> If the variable or constant is of a simple type (i.e., not a <link linkend="parametricClasses">parameterized type</link>), then it is *************** *** 928,932 **** <section id="localMethods"><title>Local methods</title> <para> ! Local methods are similar to toplevel methods, except that they are defined inside another method, and therefore only usable in that scope. --- 1093,1098 ---- <section id="localMethods"><title>Local methods</title> <para> ! Local methods are similar to regular methods (defined ! at the package or class level), except that they are defined inside another method, and therefore only usable in that scope. *************** *** 1006,1009 **** --- 1172,1230 ---- Otherwise, the compiler reports an ambiguity error. </para> + <section id="blockCall"><title>Block Syntax for Method Calls</title> + <para> + Nice supports an alternative syntax for method calls when one + of the arguments is a method of type <literal><type>void-> + <replaceable>T</replaceable></type></literal>: + </para> + <programlisting language="nice"> + <replaceable>method-name</replaceable>(<replaceable>argument</replaceable>, ...) + { + <replaceable>argument-body</replaceable> + } + </programlisting> + <para> + If an <link linkend = "anonymousMethods"> + anonymous method</link> would normally be used, it is permissible + to omit the arguments and <literal>=></literal> and instead write + the code for the anonymous method in a block following the call. + An example will be helpful: + </para> + <example id="blockSyntaxEx"> + <title>Block syntax for method calls</title> + <programlisting lang="nice"><![CDATA[ + //First define the method we're going to call: + //Like an 'if' statement + void when(boolean condition, void->void action) + { + if (condition) + action(); + } + + //Now exercise our method with block syntax: + void main(String[] args) + { + when(1 > 0) + { + println("Math is working correctly!"); + } + } + ]]></programlisting> + </example> + <para> + Note that we could just as easily have written: + <programlisting> + when(1 > 0, () => { + println("Math is working correctly!"); + }); + </programlisting> + but with the alternative block call syntax, the code becomes + less cluttered, and easier to read. It also helps to eliminate + the distinctions between built-in statements and user-defined + methods. For instance, the standard <literal>using</literal> + statement is actually just a method defined in the standard + library. + </para> + </section> </section> *************** *** 1113,1148 **** as in Java. </para> ! <para> ! Nice also allows multi-line string literals, using syntax borrowed ! from the Python language. Multi-line strings begin and end with ! three double quotes. Within multi-line strings, double quotes do ! not need to be escaped, unless there are three in a row. ! </para> ! <example> ! <title>Multi-line strings</title> ! <programlisting lang="nice"><![CDATA[ ! let greeting = """ Hello, world. You may be thinking, "Why was I called here today?" Well, there was a good reason. Honest. ! """; ! ]]></programlisting> ! </example> ! <para> ! Strings can be combined by simple juxtaposition - that is, by ! placing them side by side with some other expression. For ! example: ! </para> ! <example> ! <title>String concatenation</title> ! <programlisting lang="nice"><![CDATA[ ! String name = "Nice"; ! int factor = 10; ! println("My favorite language is " name ", which is " factor " times better than what they make me use at work."); ! ]]> ! </programlisting> ! </example> ! </section> --- 1334,1376 ---- as in Java. </para> ! <section id="multiLine"><title>Multi-line Strings</title> ! <para> ! Nice also allows multi-line string literals, using syntax borrowed ! from the Python language. Multi-line strings begin and end with ! three double quotes. Within multi-line strings, double quotes do ! not need to be escaped, unless there are three in a row. ! </para> ! <example> ! <title>Multi-line strings</title> ! <programlisting lang="nice"><![CDATA[ ! let greeting = """ Hello, world. You may be thinking, "Why was I called here today?" Well, there was a good reason. Honest. ! """; ! ]]></programlisting> ! </example> ! </section> ! <section id="stringConcat"><title>String concatenation</title> ! <para> ! Just as in many other languages, strings can be concatenated ! using the plus (<literal>+</literal>) operator. ! </para> ! <para> ! Strings can also be combined by simple juxtaposition - that is, by ! placing them side by side with some other expression. For ! example: ! </para> ! <example> ! <title>String concatenation</title> ! <programlisting lang="nice"><![CDATA[ ! String name = "Nice"; ! int factor = 10; ! println("My favorite language is " name ", which is " factor " times better than what they make me use at work."); ! ]]> ! </programlisting> ! </example> ! </section> </section> *************** *** 1419,1423 **** <para> ! The second solution is to tell once and for all the compiler the precise type of the method (this is also useful for methods with parametric types): --- 1647,1651 ---- <para> ! The second solution is to once and for all tell the compiler the precise type of the method (this is also useful for methods with parametric types): *************** *** 1594,1597 **** --- 1822,1860 ---- aren't &NULL; again, unless you actually want to allow &NULL;s. </para> + <para> + It's important to remember that nullness inference doesn't + work on fields of objects, only on local variables. There's + a good reason for this: the value of an instance variable may + have changed (updated by another thread, perhaps) between + the time the value was checked for nullness and the time it + is actually used. To avoid this problem, simply take a local + reference to the field first: + </para> + <example> + <title>Nullness inference with fields</title> + <programlisting lang="nice"> + class Person + { + ?String name + } + + //Takes a String, not a ?String + void printName(String name) + { + println(name); + } + + void main(String[] args) + { + Person p = loadPersonFromFile(args[0]); + let name = p.name; + if (name == null) + throw new Exception("Unknown person!"); + else + //safe to call printName, we know name is a String. + printName(name); + } + </programlisting> + </example> <para id="notNull"> |
From: <ar...@us...> - 2004-02-25 15:00:59
|
Update of /cvsroot/nice/Nice/stdlib/nice/lang In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv3867/F:/nice/stdlib/nice/lang Modified Files: java-io.nice Log Message: Removed superfluous retypings from java-io.nice because of strict import. Index: java-io.nice =================================================================== RCS file: /cvsroot/nice/Nice/stdlib/nice/lang/java-io.nice,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** java-io.nice 24 Feb 2004 16:04:59 -0000 1.2 --- java-io.nice 25 Feb 2004 14:53:46 -0000 1.3 *************** *** 20,25 **** */ ! import java.io.*; ! import java.net.*; /** --- 20,24 ---- */ ! import java.io.*(!); /** *************** *** 40,143 **** // Constructors - BufferedInputStream BufferedInputStream(InputStream) = native new BufferedInputStream(InputStream); - BufferedInputStream BufferedInputStream(InputStream, int) = native new BufferedInputStream(InputStream, int); - BufferedOutputStream BufferedOutputStream(OutputStream) = native new BufferedOutputStream(OutputStream); - BufferedOutputStream BufferedOutputStream(OutputStream, int) = native new BufferedOutputStream(OutputStream, int); - BufferedReader BufferedReader(Reader) = native new BufferedReader(Reader); - BufferedReader BufferedReader(Reader,int) = native new BufferedReader(Reader, int); - BufferedWriter BufferedWriter(Writer) = native new BufferedWriter(Writer); - BufferedWriter BufferedWriter(Writer, int) = native new BufferedWriter(Writer, int); - ByteArrayInputStream ByteArrayInputStream(byte[]) = native new ByteArrayInputStream(byte[]); - ByteArrayInputStream ByteArrayInputStream(byte[], int, int) = native new ByteArrayInputStream(byte[], int, int); - ByteArrayOutputStream ByteArrayOutputStream(int) = native new ByteArrayOutputStream(int); - CharArrayReader CharArrayReader(char[]) = native new CharArrayReader(char[]); - CharArrayReader CharArrayReader(char[], int, int) = native new CharArrayReader(char[], int, int); - DataInputStream DataInputStream(InputStream) = native new DataInputStream(InputStream); - DataOutputStream DataOutputStream(OutputStream) = native new DataOutputStream(OutputStream); File File(?File, String) = native new File(File, String); - File File(String) = native new File(String); File File(?String, String) = native new File(String, String); - File File(URI) = native new File(URI); - FileInputStream FileInputStream(File) = native new FileInputStream(File); - FileInputStream FileInputStream(FileDescriptor) = native new FileInputStream(FileDescriptor); - FileInputStream FileInputStream(String) = native new FileInputStream(String); - FileOutputStream FileOutputStream(File) = native new FileOutputStream(File); - FileOutputStream FileOutputStream(File, boolean) = native new FileOutputStream(File, boolean); - FileOutputStream FileOutputStream(FileDescriptor) = native new FileOutputStream(FileDescriptor); - FileOutputStream FileOutputStream(String) = native new FileOutputStream(String); - FileOutputStream FileOutputStream(String, boolean) = native new FileOutputStream(String, boolean); - FilePermission FilePermission(String, String) = native new FilePermission(String, String); - FileReader FileReader(File) = native new FileReader(File); - FileReader FileReader(FileDescriptor) = native new FileReader(FileDescriptor); - FileReader FileReader(String) = native new FileReader(String); - FileWriter FileWriter(File) = native new FileWriter(File); - FileWriter FileWriter(File, boolean) = native new FileWriter(File, boolean); - FileWriter FileWriter(FileDescriptor) = native new FileWriter(FileDescriptor); - FileWriter FileWriter(String) = native new FileWriter(String); - FileWriter FileWriter(String, boolean) = native new FileWriter(String, boolean); - FilterInputStream FilterInputStream(InputStream) = native new FilterInputStream(InputStream); - FilterOutputStream FilterOutputStream(OutputStream) = native new FilterOutputStream(OutputStream); - FilterReader FilterReader(Reader) = native new FilterReader(Reader); - FilterWriter FilterWriter(Writer) = native new FilterWriter(Writer); - - // InputStreams - int read(InputStream, byte[]) = native int InputStream.read(byte[]); - int read(InputStream, byte[], int, int) = native int InputStream.read( byte[], int, int); - void unread(PushbackInputStream, byte[]) = native void PushbackInputStream.unread(byte[]); - void unread(PushbackInputStream, byte[], int, int) = native void PushbackInputStream.unread( byte[], int, int); - void connect(PipedInputStream, PipedOutputStream) = native void PipedInputStream.connect(PipedOutputStream); // OutputStreams - void write(OutputStream, byte[]) = native void OutputStream.write(byte[]); - void write(OutputStream, byte[], int, int) = native void OutputStream.write( byte[], int, int); - byte[] toByteArray(ByteArrayOutputStream) = native byte[] ByteArrayOutputStream.toByteArray(); - String toString(ByteArrayOutputStream, String) = native String ByteArrayOutputStream.toString(String); - void writeTo(ByteArrayOutputStream, OutputStream) = native void ByteArrayOutputStream.writeTo(OutputStream); - <T> void print(PrintStream, T) = native void PrintStream.print(Object); - void print(PrintStream, String) = native void PrintStream.print(String); - void print(PrintStream, char[]) = native void PrintStream.print(char[]); <T> void println(PrintStream, T) = native void PrintStream.println(Object); - void println(PrintStream, String) = native void PrintStream.println(String); - void println(PrintStream, char[]) = native void PrintStream.println(char[]); - void connect(PipedOutputStream, PipedInputStream) = native void PipedOutputStream.connect(PipedInputStream); // Readers - int read(Reader, char[]) = native int Reader.read(char[]); - int read(Reader, char[], int, int) = native int Reader.read(char[], int, int); ?String readLine(BufferedReader) = native String BufferedReader.readLine(); - void unread(PushbackReader, char[]) = native void PushbackReader.unread(char[]); - void unread(PushbackReader, char[], int, int) = native void PushbackReader.unread(char[], int, int); ?String getEncoding(InputStreamReader) = native String InputStreamReader.getEncoding(); - void connect(PipedReader, PipedWriter) = native void PipedReader.connect(PipedWriter); // Writers - void write(Writer, char[]) = native void Writer.write(char[]); - void write(Writer, char[], int, int) = native void Writer.write(char[], int, int); - void write(Writer, String) = native void Writer.write(String); - void write(Writer, String, int, int) = native void Writer.write(String, int, int); - char[] toCharArray(CharArrayWriter) = native char[] CharArrayWriter.toCharArray(); - void writeTo(CharArrayWriter, Writer) = native void CharArrayWriter.writeTo(Writer); ?String getEncoding(OutputStreamWriter) = native String OutputStreamWriter.getEncoding(); - void connect(PipedWriter, PipedReader) = native void PipedWriter.connect(PipedReader); <T> void print(PrintWriter, T) = native void PrintWriter.print(Object); - void print(PrintWriter, String) = native void PrintWriter.print(String); - void print(PrintWriter, char[]) = native void PrintWriter.print(char[]); <T> void println(PrintWriter, T) = native void PrintWriter.println(Object); - void println(PrintWriter, String) = native void PrintWriter.println(String); - void println(PrintWriter, char[]) = native void PrintWriter.println(char[]); - StringBuffer getBuffer(StringWriter) = native StringBuffer StringWriter.getBuffer(); // File File createTempFile(String, ?String) = native File File.createTempFile(String, String); File createTempFile(String, ?String, ?File) = native File File.createTempFile(String, String, File); - File getAbsoluteFile(File) = native File File.getAbsoluteFile(); - String getAbsolutePath(File) = native String File.getAbsolutePath(); - File getCanonicalFile(File) = native File File.getCanonicalFile(); - String getCanonicalPath(File) = native String File.getCanonicalPath(); - String getName(File) = native String File.getName(); ?String getParent(File) = native String File.getParent(); ?File getParentFile(File) = native File File.getParentFile(); - String getPath(File) = native String File.getPath(); ?(String[]) list(File) = native String[] File.list(); ?(String[]) list(File, FilenameFilter) = native String[] File.list(FilenameFilter); --- 39,63 ---- *************** *** 146,171 **** ?(File[]) listFiles(File, FilenameFilter) = native File[] File.listFiles(FilenameFilter); ?(File[]) listRoots() = native File[] File.listRoots(); - URI toURI(File) = native URI File.toURI(); - URL toURL(File) = native URL File.toURL(); // DataInput/Output - void readFully(DataInput, byte[]) = native void DataInput.readFully(byte[]); - void readFully(DataInput, byte[], int, int) = native void DataInput.readFully( byte[], int, int); ?String readLine(DataInput) = native String DataInput.readLine(); - String readUTF(DataInput) = native String DataInput.readUTF(); - void write(DataOutput, byte[]) = native void DataOutput.write(byte[]); - void write(DataOutput, byte[], int, int) = native void DataOutput.write( byte[], int, int); - void writeBytes(DataOutput, String) = native void DataOutput.writeBytes(String); - void writeChars(DataOutput, String) = native void DataOutput.writeChars(String); - void writeUTF(DataOutput, String) = native void DataOutput.writeUTF(String); // Serialization <T> void writeObject(ObjectOutput, T) = native void ObjectOutput.writeObject(Object); <T> T readObject(ObjectInput) = native Object ObjectInput.readObject(); - - void readExternal(Externalizable, ObjectInput) = native void Externalizable.readExternal(ObjectInput); - void writeExternal(Externalizable, ObjectOutput) = native void Externalizable.writeExternal(ObjectOutput); - - // Other - boolean accept(FileFilter, File) = native boolean FileFilter.accept(File); - boolean accept(FilenameFilter, File, String) = native boolean FilenameFilter.accept(File, String); --- 66,74 ---- |
From: <ar...@us...> - 2004-02-25 14:30:34
|
Update of /cvsroot/nice/Nice/src/bossa/modules In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv29241/F:/nice/src/bossa/modules Modified Files: Package.java Log Message: Put the strictimport in package.nicei Index: Package.java =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/modules/Package.java,v retrieving revision 1.112 retrieving revision 1.113 diff -C2 -d -r1.112 -r1.113 *** Package.java 16 Feb 2004 21:47:12 -0000 1.112 --- Package.java 25 Feb 2004 14:23:20 -0000 1.113 *************** *** 17,20 **** --- 17,21 ---- import gnu.bytecode.*; import gnu.expr.*; + import nice.tools.code.Import; import java.util.*; *************** *** 430,434 **** for(int i = 0; i < opens.length; i++) { ! f.print("import " + opens[i] + ".*;\n"); } f.println(); --- 431,436 ---- for(int i = 0; i < opens.length; i++) { ! f.print("import " + opens[i] + ".*" + ! (Import.isStrictPackage(opens[i]) ? "(!)" : "") + ";\n"); } f.println(); |
From: <ar...@us...> - 2004-02-25 14:30:34
|
Update of /cvsroot/nice/Nice/src/nice/tools/code In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv29241/F:/nice/src/nice/tools/code Modified Files: Import.java Log Message: Put the strictimport in package.nicei Index: Import.java =================================================================== RCS file: /cvsroot/nice/Nice/src/nice/tools/code/Import.java,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** Import.java 20 Feb 2004 00:58:05 -0000 1.4 --- Import.java 25 Feb 2004 14:23:21 -0000 1.5 *************** *** 191,193 **** --- 191,198 ---- strictPackages.add(name); } + + public static boolean isStrictPackage(String name) + { + return strictPackages.contains(name); + } } |
From: <bo...@us...> - 2004-02-25 11:31:05
|
Update of /cvsroot/nice/Nice/stdlib/nice/lang/inline In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv27227/stdlib/nice/lang/inline Modified Files: ReferenceOp.java OptionOr.java CompOp.java Log Message: Separated high-level type operations (in nice.tools.typing.Types) from the ones related to code generation (in nice.tools.code.Types). Index: ReferenceOp.java =================================================================== RCS file: /cvsroot/nice/Nice/stdlib/nice/lang/inline/ReferenceOp.java,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** ReferenceOp.java 22 Jul 2003 14:09:55 -0000 1.4 --- ReferenceOp.java 25 Feb 2004 11:23:27 -0000 1.5 *************** *** 183,187 **** ! if (exp != null && nice.tools.code.Types.isSure(exp.getType().getMonotype())) bossa.util.User.warning(exp, "Comparing a non-null value with null"); } --- 183,187 ---- ! if (exp != null && nice.tools.typing.Types.isSure(exp.getType().getMonotype())) bossa.util.User.warning(exp, "Comparing a non-null value with null"); } *************** *** 193,195 **** throw new Error("Not implemented"); } ! } \ No newline at end of file --- 193,195 ---- throw new Error("Not implemented"); } ! } Index: OptionOr.java =================================================================== RCS file: /cvsroot/nice/Nice/stdlib/nice/lang/inline/OptionOr.java,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** OptionOr.java 30 Jan 2004 00:17:52 -0000 1.5 --- OptionOr.java 25 Feb 2004 11:23:27 -0000 1.6 *************** *** 58,62 **** public void checkSpecialRequirements(bossa.syntax.Expression[] arguments) { ! if (nice.tools.code.Types.isSure(arguments[0].getType().getMonotype())) bossa.util.User.warning(arguments[0], "First argument is a non-null value thus the second one will not be used."); } --- 58,62 ---- public void checkSpecialRequirements(bossa.syntax.Expression[] arguments) { ! if (nice.tools.typing.Types.isSure(arguments[0].getType().getMonotype())) bossa.util.User.warning(arguments[0], "First argument is a non-null value thus the second one will not be used."); } Index: CompOp.java =================================================================== RCS file: /cvsroot/nice/Nice/stdlib/nice/lang/inline/CompOp.java,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** CompOp.java 1 Sep 2003 20:17:31 -0000 1.5 --- CompOp.java 25 Feb 2004 11:23:27 -0000 1.6 *************** *** 157,161 **** if (literalexp != null) { ! mlsub.typing.TypeConstructor tc = nice.tools.code.Types.equivalent(otherexp.getType().getMonotype()).head(); if (mlsub.typing.Typing.testRigidLeq(tc, literalexp.tc) && ! (mlsub.typing.Typing.testRigidLeq(literalexp.tc, tc))) --- 157,161 ---- if (literalexp != null) { ! mlsub.typing.TypeConstructor tc = nice.tools.typing.Types.equivalent(otherexp.getType().getMonotype()).head(); if (mlsub.typing.Typing.testRigidLeq(tc, literalexp.tc) && ! (mlsub.typing.Typing.testRigidLeq(literalexp.tc, tc))) |
Update of /cvsroot/nice/Nice/src/bossa/syntax In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv27227/src/bossa/syntax Modified Files: typecheck.nice tools.nice analyse.nice UserOperator.java TupleExp.java PolySymbol.java Pattern.java OverloadedSymbolExp.java NiceClass.java NewArrayExp.java Monotype.java MonoSymbol.java MethodImplementation.java MethodDeclaration.java MethodContainer.java MethodBodyDefinition.java LiteralArrayExp.java FunSymbol.java FunExp.java DefaultMethodImplementation.java Contract.java CallExp.java Block.java Log Message: Separated high-level type operations (in nice.tools.typing.Types) from the ones related to code generation (in nice.tools.code.Types). Index: typecheck.nice =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/syntax/typecheck.nice,v retrieving revision 1.96 retrieving revision 1.97 diff -C2 -d -r1.96 -r1.97 *** typecheck.nice 2 Feb 2004 23:21:44 -0000 1.96 --- typecheck.nice 25 Feb 2004 11:23:28 -0000 1.97 *************** *** 671,675 **** target.type = checkMonomorphic(value.getType(), decl); ! if (nice.tools.code.Types.isVoid(target.type)) throw error(decl, "A variable cannot have a void type"); } --- 671,675 ---- target.type = checkMonomorphic(value.getType(), decl); ! if (nice.tools.typing.Types.isVoid(target.type)) throw error(decl, "A variable cannot have a void type"); } *************** *** 739,743 **** target.type = notNull(PrimitiveType.intType); ! if (nice.tools.code.Types.isVoid(target.type)) throw error(decl, "A variable cannot have a void type"); --- 739,743 ---- target.type = notNull(PrimitiveType.intType); ! if (nice.tools.typing.Types.isVoid(target.type)) throw error(decl, "A variable cannot have a void type"); *************** *** 771,775 **** notNull(decl.left).type = checkMonomorphic(type, decl); ! if (nice.tools.code.Types.isVoid(notNull(decl.left).type)) throw error(decl, "A variable cannot have a void type"); --- 771,775 ---- notNull(decl.left).type = checkMonomorphic(type, decl); ! if (nice.tools.typing.Types.isVoid(notNull(decl.left).type)) throw error(decl, "A variable cannot have a void type"); *************** *** 859,863 **** else { ! if (! r.fake && nice.tools.code.Types.isVoid(expectedType)) throw bossa.util.User.error(r, "Cannot return a value here"); --- 859,863 ---- else { ! if (! r.fake && nice.tools.typing.Types.isVoid(expectedType)) throw bossa.util.User.error(r, "Cannot return a value here"); *************** *** 871,875 **** try{ ! if ( !(r.fake && expectedType != null && nice.tools.code.Types.isVoid(expectedType))) function.checkReturnedType(r.returnType()); } --- 871,875 ---- try{ ! if (! (r.fake && expectedType != null && nice.tools.typing.Types.isVoid(expectedType))) function.checkReturnedType(r.returnType()); } *************** *** 895,899 **** s.object = notNull(s.object).noOverloading(); mlsub.typing.Polytype type = notNull(s.object).getType(); ! if (isPrimitive(type)) throw bossa.util.User.error(s.object, "Synchronization cannot be done on primitive values"); --- 895,899 ---- s.object = notNull(s.object).noOverloading(); mlsub.typing.Polytype type = notNull(s.object).getType(); ! if (nice.tools.typing.Types.isPrimitive(type)) throw bossa.util.User.error(s.object, "Synchronization cannot be done on primitive values"); *************** *** 986,992 **** } - boolean isPrimitive(mlsub.typing.Polytype type) = - nice.tools.code.Types.javaType(type) instanceof gnu.bytecode.PrimType; - void checkNotNull(mlsub.typing.Polytype type) { --- 986,989 ---- Index: tools.nice =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/syntax/tools.nice,v retrieving revision 1.31 retrieving revision 1.32 diff -C2 -d -r1.31 -r1.32 *** tools.nice 18 Feb 2004 11:50:54 -0000 1.31 --- tools.nice 25 Feb 2004 11:23:28 -0000 1.32 *************** *** 61,68 **** mlsub.typing.Monotype makeSure(mlsub.typing.Monotype m) = ! notNull(bossa.syntax.Monotype.sure(nice.tools.code.Types.rawType(m))); mlsub.typing.Monotype makeUnsure(mlsub.typing.Monotype m) = ! notNull(bossa.syntax.Monotype.maybe(nice.tools.code.Types.rawType(m))); mlsub.typing.Monotype checkMonomorphic(mlsub.typing.Polytype type, --- 61,68 ---- mlsub.typing.Monotype makeSure(mlsub.typing.Monotype m) = ! notNull(bossa.syntax.Monotype.sure(nice.tools.typing.Types.rawType(m))); mlsub.typing.Monotype makeUnsure(mlsub.typing.Monotype m) = ! notNull(bossa.syntax.Monotype.maybe(nice.tools.typing.Types.rawType(m))); mlsub.typing.Monotype checkMonomorphic(mlsub.typing.Polytype type, *************** *** 122,126 **** else { ! let originalType = nice.tools.code.Types.rawType(sym.getMonotype()); if (originalType instanceof mlsub.typing.MonotypeConstructor) parameters = originalType.getTP(); --- 122,126 ---- else { ! let originalType = nice.tools.typing.Types.rawType(sym.getMonotype()); if (originalType instanceof mlsub.typing.MonotypeConstructor) parameters = originalType.getTP(); Index: analyse.nice =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/syntax/analyse.nice,v retrieving revision 1.100 retrieving revision 1.101 diff -C2 -d -r1.100 -r1.101 *** analyse.nice 12 Feb 2004 23:54:22 -0000 1.100 --- analyse.nice 25 Feb 2004 11:23:28 -0000 1.101 *************** *** 194,198 **** { symbol.type = notNull(type.resolve(this.typeMap)); ! if (nice.tools.code.Types.isVoid(symbol.type)) throw error(symbol, "A variable cannot have a void type"); } --- 194,198 ---- { symbol.type = notNull(type.resolve(this.typeMap)); ! if (nice.tools.typing.Types.isVoid(symbol.type)) throw error(symbol, "A variable cannot have a void type"); } Index: UserOperator.java =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/syntax/UserOperator.java,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** UserOperator.java 2 Feb 2004 19:02:28 -0000 1.8 --- UserOperator.java 25 Feb 2004 11:23:28 -0000 1.9 *************** *** 60,64 **** mlsub.typing.Monotype[] paramTypes = getArgTypes(); for (int i = 0; i < symbols.length; i++) { ! if (Types.isVoid(paramTypes[i])) throw bossa.util.User.error(symbols[i].syntacticType, "A parameter cannot have a void type"); --- 60,64 ---- mlsub.typing.Monotype[] paramTypes = getArgTypes(); for (int i = 0; i < symbols.length; i++) { ! if (nice.tools.typing.Types.isVoid(paramTypes[i])) throw bossa.util.User.error(symbols[i].syntacticType, "A parameter cannot have a void type"); Index: TupleExp.java =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/syntax/TupleExp.java,v retrieving revision 1.22 retrieving revision 1.23 diff -C2 -d -r1.22 -r1.23 *** TupleExp.java 11 Feb 2004 12:46:39 -0000 1.22 --- TupleExp.java 25 Feb 2004 11:23:28 -0000 1.23 *************** *** 77,81 **** void adjustToExpectedType(Monotype expectedType) { ! Monotype m = Types.equivalent(expectedType); // Get the expected component types --- 77,81 ---- void adjustToExpectedType(Monotype expectedType) { ! Monotype m = nice.tools.typing.Types.equivalent(expectedType); // Get the expected component types Index: PolySymbol.java =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/syntax/PolySymbol.java,v retrieving revision 1.17 retrieving revision 1.18 diff -C2 -d -r1.17 -r1.18 *** PolySymbol.java 30 Aug 2003 10:57:32 -0000 1.17 --- PolySymbol.java 25 Feb 2004 11:23:28 -0000 1.18 *************** *** 14,18 **** import mlsub.typing.Polytype; ! import nice.tools.code.Types; import bossa.util.*; --- 14,18 ---- import mlsub.typing.Polytype; ! import nice.tools.typing.Types; import bossa.util.*; Index: Pattern.java =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/syntax/Pattern.java,v retrieving revision 1.79 retrieving revision 1.80 diff -C2 -d -r1.79 -r1.80 *** Pattern.java 22 Feb 2004 14:48:59 -0000 1.79 --- Pattern.java 25 Feb 2004 11:23:28 -0000 1.80 *************** *** 21,27 **** import mlsub.typing.Typing; import mlsub.typing.TypingEx; import gnu.expr.*; ! import nice.tools.code.*; /** --- 21,28 ---- import mlsub.typing.Typing; import mlsub.typing.TypingEx; + import nice.tools.typing.Types; import gnu.expr.*; ! import nice.tools.code.Gen; /** *************** *** 808,812 **** return Gen.referenceEqualsExp(atValue.compile(), parameter); ! gnu.bytecode.Type ct = Types.javaType(tc); if (exactlyAt) return Gen.isOfClass(parameter, ct); --- 809,813 ---- return Gen.referenceEqualsExp(atValue.compile(), parameter); ! gnu.bytecode.Type ct = nice.tools.code.Types.javaType(tc); if (exactlyAt) return Gen.isOfClass(parameter, ct); Index: OverloadedSymbolExp.java =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/syntax/OverloadedSymbolExp.java,v retrieving revision 1.66 retrieving revision 1.67 diff -C2 -d -r1.66 -r1.67 *** OverloadedSymbolExp.java 3 Feb 2004 10:20:48 -0000 1.66 --- OverloadedSymbolExp.java 25 Feb 2004 11:23:28 -0000 1.67 *************** *** 24,28 **** import mlsub.typing.Monotype; ! import nice.tools.code.Types; /** --- 24,28 ---- import mlsub.typing.Monotype; ! import nice.tools.typing.Types; /** *************** *** 201,205 **** VarSymbol res = (VarSymbol) symbols.get(0); // store the formal argument types for later use together with the type ! callExp.argTypes = nice.tools.code.Types.domain(res.getClonedType()); res.releaseClonedType(); --- 201,205 ---- VarSymbol res = (VarSymbol) symbols.get(0); // store the formal argument types for later use together with the type ! callExp.argTypes = nice.tools.typing.Types.parameters(res.getClonedType()); res.releaseClonedType(); *************** *** 261,265 **** return res; ! if (Types.domain(expectedType) != null) { // in case of function objects symbols find the most precise match List nonMin = removeNonMinimal(symbols); --- 261,265 ---- return res; ! if (Types.parameters(expectedType) != null) { // in case of function objects symbols find the most precise match List nonMin = removeNonMinimal(symbols); *************** *** 383,387 **** for(int s1 = 0; s1<len; s1++) { ! Domain d1 = domain(syms[s1].getType()); for(int s2 = 0; s2<len; s2++) --- 383,387 ---- for(int s1 = 0; s1<len; s1++) { ! Domain d1 = Types.domain(syms[s1].getType()); for(int s2 = 0; s2<len; s2++) *************** *** 398,402 **** if (s1 != s2 && !remove[s2]) { ! Domain d2 = domain(syms[s2].getType()); try{ --- 398,402 ---- if (s1 != s2 && !remove[s2]) { ! Domain d2 = Types.domain(syms[s2].getType()); try{ *************** *** 499,503 **** { // remove nullness marker ! Monotype[] m = Types.domain(t.getMonotype()); Monotype[] dom; --- 499,503 ---- { // remove nullness marker ! Monotype[] m = Types.parameters(t.getMonotype()); Monotype[] dom; *************** *** 523,534 **** } - private static Domain domain(Polytype t) - { - // remove nullness marker - Monotype[] m = Types.domain(t.getMonotype()); - - return new Domain(t.getConstraint(), new TupleType(m)); - } - void computeType() { --- 523,526 ---- Index: NiceClass.java =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/syntax/NiceClass.java,v retrieving revision 1.77 retrieving revision 1.78 diff -C2 -d -r1.77 -r1.78 *** NiceClass.java 22 Dec 2003 01:30:59 -0000 1.77 --- NiceClass.java 25 Feb 2004 11:23:29 -0000 1.78 *************** *** 159,163 **** sym.type = sym.syntacticType.resolve(typeScope); ! if (Types.isVoid(sym.type)) User.error(sym, "A field cannot have void type"); --- 159,163 ---- sym.type = sym.syntacticType.resolve(typeScope); ! if (nice.tools.typing.Types.isVoid(sym.type)) User.error(sym, "A field cannot have void type"); Index: NewArrayExp.java =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/syntax/NewArrayExp.java,v retrieving revision 1.18 retrieving revision 1.19 diff -C2 -d -r1.18 -r1.19 *** NewArrayExp.java 11 Dec 2003 23:41:57 -0000 1.18 --- NewArrayExp.java 25 Feb 2004 11:23:29 -0000 1.19 *************** *** 18,22 **** import gnu.bytecode.*; ! import nice.tools.code.Types; import mlsub.typing.Monotype; --- 18,22 ---- import gnu.bytecode.*; ! import nice.tools.typing.Types; import mlsub.typing.Monotype; *************** *** 177,181 **** public gnu.expr.Expression compile() { ! Type t = Types.javaType(type); return new gnu.expr.ApplyExp --- 177,181 ---- public gnu.expr.Expression compile() { ! Type t = nice.tools.code.Types.javaType(type); return new gnu.expr.ApplyExp Index: Monotype.java =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/syntax/Monotype.java,v retrieving revision 1.33 retrieving revision 1.34 diff -C2 -d -r1.33 -r1.34 *** Monotype.java 28 May 2003 12:57:26 -0000 1.33 --- Monotype.java 25 Feb 2004 11:23:29 -0000 1.34 *************** *** 114,118 **** if (raw instanceof MonotypeVar) { ! nice.tools.code.Types.makeMarkedType((MonotypeVar) raw); return raw; } --- 114,118 ---- if (raw instanceof MonotypeVar) { ! nice.tools.typing.Types.makeMarkedType((MonotypeVar) raw); return raw; } Index: MonoSymbol.java =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/syntax/MonoSymbol.java,v retrieving revision 1.28 retrieving revision 1.29 diff -C2 -d -r1.28 -r1.29 *** MonoSymbol.java 30 Nov 2003 13:09:21 -0000 1.28 --- MonoSymbol.java 25 Feb 2004 11:23:29 -0000 1.29 *************** *** 15,19 **** import mlsub.typing.Polytype; import mlsub.typing.FunTypeKind; ! import nice.tools.code.Types; import bossa.util.*; --- 15,19 ---- import mlsub.typing.Polytype; import mlsub.typing.FunTypeKind; ! import nice.tools.typing.Types; import bossa.util.*; Index: MethodImplementation.java =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/syntax/MethodImplementation.java,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** MethodImplementation.java 24 Nov 2003 23:56:25 -0000 1.3 --- MethodImplementation.java 25 Feb 2004 11:23:29 -0000 1.4 *************** *** 20,24 **** */ ! import nice.tools.code.Types; import nice.tools.code.Gen; import mlsub.typing.Typing; --- 20,24 ---- */ ! import nice.tools.typing.Types; import nice.tools.code.Gen; import mlsub.typing.Typing; Index: MethodDeclaration.java =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/syntax/MethodDeclaration.java,v retrieving revision 1.53 retrieving revision 1.54 diff -C2 -d -r1.53 -r1.54 *** MethodDeclaration.java 22 Dec 2003 01:30:59 -0000 1.53 --- MethodDeclaration.java 25 Feb 2004 11:23:29 -0000 1.54 *************** *** 21,25 **** import mlsub.typing.Constraint; ! import nice.tools.code.Types; import gnu.bytecode.*; --- 21,25 ---- import mlsub.typing.Constraint; ! import nice.tools.typing.Types; import gnu.bytecode.*; *************** *** 427,436 **** public gnu.bytecode.Type javaReturnType() { ! return Types.javaType(getReturnType()); } public gnu.bytecode.Type[] javaArgTypes() { ! return Types.javaType(getType().domain()); } --- 427,436 ---- public gnu.bytecode.Type javaReturnType() { ! return nice.tools.code.Types.javaType(getReturnType()); } public gnu.bytecode.Type[] javaArgTypes() { ! return nice.tools.code.Types.javaType(getType().domain()); } Index: MethodContainer.java =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/syntax/MethodContainer.java,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -d -r1.14 -r1.15 *** MethodContainer.java 27 Jan 2004 15:03:26 -0000 1.14 --- MethodContainer.java 25 Feb 2004 11:23:29 -0000 1.15 *************** *** 112,116 **** // The type parameters have nullness markers. for (int i = 0; i < typeParameters.length; i++) ! nice.tools.code.Types.makeMarkedType(typeParameters[i]); } --- 112,116 ---- // The type parameters have nullness markers. for (int i = 0; i < typeParameters.length; i++) ! nice.tools.typing.Types.makeMarkedType(typeParameters[i]); } Index: MethodBodyDefinition.java =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/syntax/MethodBodyDefinition.java,v retrieving revision 1.147 retrieving revision 1.148 diff -C2 -d -r1.147 -r1.148 *** MethodBodyDefinition.java 15 Dec 2003 14:04:13 -0000 1.147 --- MethodBodyDefinition.java 25 Feb 2004 11:23:29 -0000 1.148 *************** *** 21,25 **** import bossa.util.Debug; import bossa.util.Location; ! import nice.tools.code.Types; import nice.tools.code.Gen; --- 21,25 ---- import bossa.util.Debug; import bossa.util.Location; ! import nice.tools.typing.Types; import nice.tools.code.Gen; *************** *** 91,95 **** // it was equivalent to the declaration type and has been erased, // so we return the information in the declaration. ! return nice.tools.code.Types.equivalent(declaration.getArgTypes()[0]). head(); } --- 91,95 ---- // it was equivalent to the declaration type and has been erased, // so we return the information in the declaration. ! return Types.equivalent(declaration.getArgTypes()[0]). head(); } *************** *** 452,456 **** try { ! Types.setBytecodeType(monotypes); Typing.implies(); --- 452,456 ---- try { ! nice.tools.code.Types.setBytecodeType(monotypes); Typing.implies(); *************** *** 503,510 **** for(int n = 0; n < parameters.length; n++) res[n] = formals[n].atNull() ? ! Types.javaType(PrimitiveType.nullTC) : formals[n].tc == bossa.syntax.PrimitiveType.arrayTC ? nice.tools.code.SpecialArray.unknownTypeArray() : ! Types.javaType(parameters[n].getMonotype()); return res; --- 503,510 ---- for(int n = 0; n < parameters.length; n++) res[n] = formals[n].atNull() ? ! nice.tools.code.Types.javaType(PrimitiveType.nullTC) : formals[n].tc == bossa.syntax.PrimitiveType.arrayTC ? nice.tools.code.SpecialArray.unknownTypeArray() : ! nice.tools.code.Types.javaType(parameters[n].getMonotype()); return res; Index: LiteralArrayExp.java =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/syntax/LiteralArrayExp.java,v retrieving revision 1.18 retrieving revision 1.19 diff -C2 -d -r1.18 -r1.19 *** LiteralArrayExp.java 11 Feb 2004 16:06:05 -0000 1.18 --- LiteralArrayExp.java 25 Feb 2004 11:23:29 -0000 1.19 *************** *** 22,26 **** import mlsub.typing.Polytype; import mlsub.typing.TypeConstructor; ! import nice.tools.code.Types; /** --- 22,26 ---- import mlsub.typing.Polytype; import mlsub.typing.TypeConstructor; ! import nice.tools.typing.Types; /** *************** *** 115,119 **** { gnu.expr.Expression[] args = Expression.compile(elements); ! ArrayType t = nice.tools.code.SpecialTypes.array(Types.lowestUpperBound(args)); return new gnu.expr.ApplyExp --- 115,120 ---- { gnu.expr.Expression[] args = Expression.compile(elements); ! ArrayType t = nice.tools.code.SpecialTypes.array ! (nice.tools.code.Types.lowestUpperBound(args)); return new gnu.expr.ApplyExp Index: FunSymbol.java =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/syntax/FunSymbol.java,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** FunSymbol.java 17 Jul 2003 11:01:03 -0000 1.9 --- FunSymbol.java 25 Feb 2004 11:23:29 -0000 1.10 *************** *** 14,18 **** import java.util.*; ! import nice.tools.code.Types; class FunSymbol extends PolySymbol --- 14,18 ---- import java.util.*; ! import nice.tools.typing.Types; class FunSymbol extends PolySymbol Index: FunExp.java =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/syntax/FunExp.java,v retrieving revision 1.44 retrieving revision 1.45 diff -C2 -d -r1.44 -r1.45 *** FunExp.java 25 Nov 2003 10:41:10 -0000 1.44 --- FunExp.java 25 Feb 2004 11:23:29 -0000 1.45 *************** *** 91,95 **** else if (! alwaysReturns && ! ! nice.tools.code.Types.isVoid(inferredReturnType)) throw User.error(this, "Missing return statement"); --- 91,95 ---- else if (! alwaysReturns && ! ! nice.tools.typing.Types.isVoid(inferredReturnType)) throw User.error(this, "Missing return statement"); Index: DefaultMethodImplementation.java =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/syntax/DefaultMethodImplementation.java,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** DefaultMethodImplementation.java 28 Nov 2003 15:17:35 -0000 1.4 --- DefaultMethodImplementation.java 25 Feb 2004 11:23:29 -0000 1.5 *************** *** 55,59 **** final mlsub.typing.TypeConstructor firstArgument() { ! return nice.tools.code.Types.equivalent(declaration.getArgTypes()[0]).head(); } --- 55,59 ---- final mlsub.typing.TypeConstructor firstArgument() { ! return nice.tools.typing.Types.equivalent(declaration.getArgTypes()[0]).head(); } Index: Contract.java =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/syntax/Contract.java,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** Contract.java 21 Dec 2003 15:07:48 -0000 1.7 --- Contract.java 25 Feb 2004 11:23:29 -0000 1.8 *************** *** 78,82 **** } ! if (! nice.tools.code.Types.isVoid(resultType)) result = new MonoSymbol(new LocatedString("result", location), resultType) { --- 78,82 ---- } ! if (! nice.tools.typing.Types.isVoid(resultType)) result = new MonoSymbol(new LocatedString("result", location), resultType) { Index: CallExp.java =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/syntax/CallExp.java,v retrieving revision 1.90 retrieving revision 1.91 diff -C2 -d -r1.90 -r1.91 *** CallExp.java 11 Feb 2004 12:46:39 -0000 1.90 --- CallExp.java 25 Feb 2004 11:23:29 -0000 1.91 *************** *** 17,21 **** import bossa.util.*; import bossa.util.Debug; ! import nice.tools.code.*; import mlsub.typing.*; --- 17,21 ---- import bossa.util.*; import bossa.util.Debug; ! import nice.tools.typing.Types; import mlsub.typing.*; *************** *** 26,29 **** --- 26,31 ---- import mlsub.typing.Constraint; + import nice.tools.code.EnsureTypeProc; + /** A function call. *************** *** 255,259 **** // Important for litteral arrays and tuples. Expression.adjustToExpectedType(arguments.computedExpressions, ! Types.domain(function.getType())); } --- 257,261 ---- // Important for litteral arrays and tuples. Expression.adjustToExpectedType(arguments.computedExpressions, ! Types.parameters(function.getType())); } *************** *** 358,362 **** } ! return EnsureTypeProc.ensure(res, Types.javaType(type)); } --- 360,364 ---- } ! return EnsureTypeProc.ensure(res, nice.tools.code.Types.javaType(type)); } *************** *** 374,378 **** for (int i = 0; i < params.length; i++) params[i] = EnsureTypeProc.ensure ! (params[i], Types.javaType(domain[i])); return params; --- 376,380 ---- for (int i = 0; i < params.length; i++) params[i] = EnsureTypeProc.ensure ! (params[i], nice.tools.code.Types.javaType(domain[i])); return params; Index: Block.java =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/syntax/Block.java,v retrieving revision 1.65 retrieving revision 1.66 diff -C2 -d -r1.65 -r1.66 *** Block.java 8 Oct 2003 21:51:43 -0000 1.65 --- Block.java 25 Feb 2004 11:23:29 -0000 1.66 *************** *** 13,17 **** package bossa.syntax; ! import nice.tools.code.Types; import bossa.util.*; --- 13,17 ---- package bossa.syntax; ! import nice.tools.typing.Types; import bossa.util.*; *************** *** 162,166 **** String getName() { return left.name.toString(); } VarSymbol getSymbol() { return left; } ! gnu.bytecode.Type getBytecodeType() { return Types.javaType(left.type); } gnu.expr.Expression initValue() --- 162,167 ---- String getName() { return left.name.toString(); } VarSymbol getSymbol() { return left; } ! gnu.bytecode.Type getBytecodeType() ! { return nice.tools.code.Types.javaType(left.type); } gnu.expr.Expression initValue() *************** *** 224,228 **** String getName() { return left.name.toString(); } VarSymbol getSymbol() { return left; } ! gnu.bytecode.Type getBytecodeType() { return Types.javaType(left.type); } MonoSymbol left; --- 225,230 ---- String getName() { return left.name.toString(); } VarSymbol getSymbol() { return left; } ! gnu.bytecode.Type getBytecodeType() ! { return nice.tools.code.Types.javaType(left.type); } MonoSymbol left; *************** *** 269,273 **** String getName() { return left.name.toString(); } VarSymbol getSymbol() { return left; } ! gnu.bytecode.Type getBytecodeType() { return Types.javaType(left.type); } mlsub.typing.Polytype inferredReturnType() --- 271,276 ---- String getName() { return left.name.toString(); } VarSymbol getSymbol() { return left; } ! gnu.bytecode.Type getBytecodeType() ! { return nice.tools.code.Types.javaType(left.type); } mlsub.typing.Polytype inferredReturnType() *************** *** 278,282 **** mlsub.typing.Monotype declaredReturnType() { ! return Types.codomain(left.getType()); } --- 281,285 ---- mlsub.typing.Monotype declaredReturnType() { ! return Types.result(left.getType()); } |
From: <bo...@us...> - 2004-02-25 11:30:36
|
Update of /cvsroot/nice/Nice/src/bossa/link In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv27227/src/bossa/link Modified Files: Dispatch.java Log Message: Separated high-level type operations (in nice.tools.typing.Types) from the ones related to code generation (in nice.tools.code.Types). Index: Dispatch.java =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/link/Dispatch.java,v retrieving revision 1.66 retrieving revision 1.67 diff -C2 -d -r1.66 -r1.67 *** Dispatch.java 24 Feb 2004 14:05:53 -0000 1.66 --- Dispatch.java 25 Feb 2004 11:23:29 -0000 1.67 *************** *** 406,410 **** MonotypeConstructor mc = (MonotypeConstructor) arg; marker = mc.getTC(); ! raw = nice.tools.code.Types.rawType(mc); } else --- 406,410 ---- MonotypeConstructor mc = (MonotypeConstructor) arg; marker = mc.getTC(); ! raw = nice.tools.typing.Types.rawType(mc); } else |
From: <bo...@us...> - 2004-02-25 11:30:35
|
Update of /cvsroot/nice/Nice/src/nice/tools/code In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv27227/src/nice/tools/code Modified Files: Types.java Log Message: Separated high-level type operations (in nice.tools.typing.Types) from the ones related to code generation (in nice.tools.code.Types). Index: Types.java =================================================================== RCS file: /cvsroot/nice/Nice/src/nice/tools/code/Types.java,v retrieving revision 1.56 retrieving revision 1.57 diff -C2 -d -r1.56 -r1.57 *** Types.java 19 Feb 2004 08:15:33 -0000 1.56 --- Types.java 25 Feb 2004 11:23:28 -0000 1.57 *************** *** 76,80 **** public static void setBytecodeType(Monotype m) { ! m = equivalent(m); if (m instanceof mlsub.typing.TupleType) --- 76,80 ---- public static void setBytecodeType(Monotype m) { ! m = nice.tools.typing.Types.equivalent(m); if (m instanceof mlsub.typing.TupleType) *************** *** 178,186 **** private static Type javaTypeOrNull(Monotype m) { ! Type res = rawJavaType(equivalent(m)); if (res == null) return null; ! boolean maybe = isMaybe(m.equivalent()); if (maybe) return equivalentObjectType(res); --- 178,186 ---- private static Type javaTypeOrNull(Monotype m) { ! Type res = rawJavaType(nice.tools.typing.Types.equivalent(m)); if (res == null) return null; ! boolean maybe = nice.tools.typing.Types.isMaybe(m.equivalent()); if (maybe) return equivalentObjectType(res); *************** *** 612,616 **** return QuoteExp.nullExp; ! TypeConstructor tc = rawType(m).head(); if (tc == null) --- 612,616 ---- return QuoteExp.nullExp; ! TypeConstructor tc = nice.tools.typing.Types.rawType(m).head(); if (tc == null) *************** *** 638,767 **** /**************************************************************** - * Predicates - ****************************************************************/ - - public static boolean isVoid(mlsub.typing.Monotype m) - { - return equivalent(m).head() == PrimitiveType.voidTC; - } - - public static boolean isVoid(mlsub.typing.Polytype t) - { - return isVoid(t.getMonotype()); - } - - public static boolean isPrimitive(TypeConstructor tc) - { - return javaType(tc) instanceof PrimType; - } - - /**************************************************************** - * Manipulations on nice types - ****************************************************************/ - - public static boolean isMaybe(Monotype m) - { - // This is prob. laxist, since getTC() might be different but equivalent to maybeTC (?) - return (m instanceof MonotypeConstructor) - && ((MonotypeConstructor) m).getTC() == PrimitiveType.maybeTC; - } - - public static boolean isSure(Monotype m) - { - // see comment by isMaybe (e?) - return (m instanceof MonotypeConstructor) - && ((MonotypeConstructor) m).getTC() == PrimitiveType.sureTC; - } - - public static Monotype equivalent(Monotype m) - { - return rawType(m).equivalent(); - } - - public static void setMarkedKind(Monotype m) - { - m.setKind(NullnessKind.instance); - } - - public static void makeMarkedType(MonotypeVar m) - { - m.setPersistentKind(NullnessKind.instance); - } - - /** return the type with nullness markers removed */ - public static Monotype rawType(Monotype m) - { - m = m.equivalent(); - if (!(m instanceof MonotypeConstructor)) - { - // It is probably a bug if this happens - //Internal.warning("Not kinded monotype: " + m); - return m; - } - else - return ((MonotypeConstructor) m).getTP()[0]; - } - - /** return the type with nullness markers removed */ - public static Monotype rawType(MonotypeConstructor mc) - { - return mc.getTP()[0]; - } - - /** @return the domain of a functional monotype with nullness marker */ - public static Monotype[] domain(Monotype type) - { - return rawType(type).domain(); - } - - /** @return the domain of a functional polytype with nullness marker */ - public static Monotype[] domain(Polytype type) - { - return rawType(type.getMonotype()).domain(); - } - - /** @return the codomain of a functional polytype with nullness marker */ - public static Monotype codomain(Polytype type) - { - return ((FunType) rawType(type.getMonotype())).codomain(); - } - - /** @return the <code>rank</code>th type parameter of this type, or null. */ - public static Monotype getTypeParameter(Polytype type, int rank) - { - // This can only help - type.simplify(); - - return getTypeParameter(type.getMonotype(), rank); - } - - /** @return the <code>rank</code>th type parameter of this type, or null. */ - public static Monotype getTypeParameter(Monotype type, int rank) - { - // get rid of the nullness part - type = nice.tools.code.Types.rawType(type); - - if (! (type instanceof MonotypeConstructor)) - return null; - - Monotype[] parameters = ((MonotypeConstructor) type).getTP(); - - if (parameters.length <= rank) - return null; - else - return parameters[rank]; - } - - /** - Transforms \forall T:K.U into \forall T:K.sure<U> - */ - public static Polytype addSure(Polytype type) - { - return new Polytype - (type.getConstraint(), - bossa.syntax.Monotype.sure(type.getMonotype())); - } - - /**************************************************************** * Reset the state for a new compilation. ****************************************************************/ --- 638,641 ---- |
From: <bo...@us...> - 2004-02-25 11:30:35
|
Update of /cvsroot/nice/Nice/src/mlsub/typing In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv27227/src/mlsub/typing Modified Files: TypeConstructorLeqMonotypeCst.java Log Message: Separated high-level type operations (in nice.tools.typing.Types) from the ones related to code generation (in nice.tools.code.Types). Index: TypeConstructorLeqMonotypeCst.java =================================================================== RCS file: /cvsroot/nice/Nice/src/mlsub/typing/TypeConstructorLeqMonotypeCst.java,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** TypeConstructorLeqMonotypeCst.java 19 Jun 2003 15:32:00 -0000 1.3 --- TypeConstructorLeqMonotypeCst.java 25 Feb 2004 11:23:28 -0000 1.4 *************** *** 60,64 **** { // Use the raw type of t2, after the nullness marker. ! Typing.leq(t1, nice.tools.code.Types.rawType(t2)); } --- 60,64 ---- { // Use the raw type of t2, after the nullness marker. ! Typing.leq(t1, nice.tools.typing.Types.rawType(t2)); } |
From: <bo...@us...> - 2004-02-25 11:30:35
|
Update of /cvsroot/nice/Nice/src/nice/tools/typing In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv27227/src/nice/tools/typing Added Files: Types.java Log Message: Separated high-level type operations (in nice.tools.typing.Types) from the ones related to code generation (in nice.tools.code.Types). --- NEW FILE: Types.java --- /**************************************************************************/ /* N I C E */ /* A high-level object-oriented research language */ /* (c) Daniel Bonniot 2004 */ /* */ /* 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 nice.tools.typing; /** Utilities for Nice types. @author Daniel Bonniot (bon...@us...) */ import mlsub.typing.*; import bossa.syntax.PrimitiveType; public final class Types { /**************************************************************** * Predicates ****************************************************************/ public static boolean isVoid(mlsub.typing.Monotype m) { return equivalent(m).head() == PrimitiveType.voidTC; } public static boolean isVoid(mlsub.typing.Polytype t) { return isVoid(t.getMonotype()); } public static boolean isPrimitive(TypeConstructor tc) { return nice.tools.code.Types.javaType(tc) instanceof gnu.bytecode.PrimType; } public static boolean isPrimitive(Polytype t) { return nice.tools.code.Types.javaType(t) instanceof gnu.bytecode.PrimType; } public static boolean isMaybe(Monotype m) { // This is prob. laxist, since getTC() might be different but equivalent to maybeTC (?) return (m instanceof MonotypeConstructor) && ((MonotypeConstructor) m).getTC() == PrimitiveType.maybeTC; } public static boolean isSure(Monotype m) { // see comment by isMaybe (e?) return (m instanceof MonotypeConstructor) && ((MonotypeConstructor) m).getTC() == PrimitiveType.sureTC; } /**************************************************************** * Handling of option types ****************************************************************/ public static Monotype equivalent(Monotype m) { return rawType(m).equivalent(); } public static void setMarkedKind(Monotype m) { m.setKind(NullnessKind.instance); } public static void makeMarkedType(MonotypeVar m) { m.setPersistentKind(NullnessKind.instance); } /** return the type with nullness markers removed */ public static Monotype rawType(Monotype m) { m = m.equivalent(); if (!(m instanceof MonotypeConstructor)) { // It is probably a bug if this happens //Internal.warning("Not kinded monotype: " + m); return m; } else return ((MonotypeConstructor) m).getTP()[0]; } /** return the type with nullness markers removed */ public static Monotype rawType(MonotypeConstructor mc) { return mc.getTP()[0]; } /**************************************************************** * Functional types ****************************************************************/ /** @return the domain of a functional monotype with nullness marker */ public static Monotype[] parameters(Monotype type) { return rawType(type).domain(); } /** @return the domain of a functional polytype with nullness marker */ public static Monotype[] parameters(Polytype type) { return rawType(type.getMonotype()).domain(); } /** @return the codomain of a functional polytype with nullness marker */ public static Monotype result(Polytype type) { return ((FunType) rawType(type.getMonotype())).codomain(); } /** @return the <code>rank</code>th type parameter of this type, or null. */ public static Monotype getTypeParameter(Polytype type, int rank) { // This can only help type.simplify(); return getTypeParameter(type.getMonotype(), rank); } /** Transforms \forall T:K.U into \forall T:K.sure<U> */ public static Polytype addSure(Polytype type) { return new Polytype (type.getConstraint(), bossa.syntax.Monotype.sure(type.getMonotype())); } /**************************************************************** * Type parameters ****************************************************************/ /** @return the <code>rank</code>th type parameter of this type, or null. */ public static Monotype getTypeParameter(Monotype type, int rank) { // get rid of the nullness part type = rawType(type); if (! (type instanceof MonotypeConstructor)) return null; Monotype[] parameters = ((MonotypeConstructor) type).getTP(); if (parameters.length <= rank) return null; else return parameters[rank]; } /**************************************************************** * Domains ****************************************************************/ public static Domain domain(Polytype t) { // remove nullness marker Monotype[] m = parameters(t.getMonotype()); return new Domain(t.getConstraint(), new TupleType(m)); } } |
From: <bo...@us...> - 2004-02-25 11:19:15
|
Update of /cvsroot/nice/Nice/src/nice/tools/typing In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv25065/src/nice/tools/typing Log Message: Directory /cvsroot/nice/Nice/src/nice/tools/typing added to the repository |
From: <bo...@us...> - 2004-02-24 18:42:01
|
Update of /cvsroot/nice/Nice/src/mlsub/typing In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv19329/src/mlsub/typing Modified Files: TypeConstructor.java Enumeration.java Log Message: Optimization: really return only one solution for those positions that are not used for dispatch. Index: TypeConstructor.java =================================================================== RCS file: /cvsroot/nice/Nice/src/mlsub/typing/TypeConstructor.java,v retrieving revision 1.16 retrieving revision 1.17 diff -C2 -d -r1.16 -r1.17 *** TypeConstructor.java 25 Apr 2003 17:21:25 -0000 1.16 --- TypeConstructor.java 24 Feb 2004 18:35:26 -0000 1.17 *************** *** 180,185 **** ****************************************************************/ - public int enumerateTagIndex = -1; // used in Typing.enumerate. ugly ! Subclass - public AtomicKind variance; private boolean concrete; --- 180,183 ---- Index: Enumeration.java =================================================================== RCS file: /cvsroot/nice/Nice/src/mlsub/typing/Enumeration.java,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** Enumeration.java 16 Dec 2003 11:39:10 -0000 1.10 --- Enumeration.java 24 Feb 2004 18:35:26 -0000 1.11 *************** *** 180,184 **** else { ! List solutions = enumerateTags(tags); res.addAll(solutions); if (solutions.size() > 0) --- 180,184 ---- else { ! List solutions = enumerateTags(tags, all); res.addAll(solutions); if (solutions.size() > 0) *************** *** 202,206 **** private static class SolutionFound extends RuntimeException {} ! private static List enumerateTags(Element[] tags) { TagsList tuples = new TagsList(tags.length); --- 202,206 ---- private static class SolutionFound extends RuntimeException {} ! private static List enumerateTags(Element[] tags, boolean[] all) { TagsList tuples = new TagsList(tags.length); *************** *** 209,212 **** --- 209,215 ---- List observers = new ArrayList(tags.length); // idem + // The variable TCs that will hold the solutions. + TypeConstructor[] vars = new TypeConstructor[tags.length]; + Engine.enter(); try{ *************** *** 243,250 **** TypeConstructor varTC = new TypeConstructor(constTC.variance); ! ! varTC.enumerateTagIndex = i; Typing.introduce(varTC); ! obs.set(varTC.getId()); try{ k.leq(varTC, constTC); --- 246,257 ---- TypeConstructor varTC = new TypeConstructor(constTC.variance); ! vars[i] = varTC; ! Typing.introduce(varTC); ! ! // We only observe those positions where all solutions are needed. ! if (all[i]) ! obs.set(varTC.getId()); ! try{ k.leq(varTC, constTC); *************** *** 261,266 **** BitVector[] pObs = (BitVector[]) observers.toArray(new BitVector[observers.size()]); ! ! if (enumerateInConstraints(pKinds, pObs, tuples, tags)) return emptyList; } --- 268,273 ---- BitVector[] pObs = (BitVector[]) observers.toArray(new BitVector[observers.size()]); ! ! if (enumerateInConstraints(pKinds, pObs, tuples, tags, vars, all)) return emptyList; } *************** *** 279,283 **** BitVector[] observers, final TagsList tuples, ! final Element[] tags) { for(int act = 0; act<kinds.length;act++) --- 286,292 ---- BitVector[] observers, final TagsList tuples, ! final Element[] tags, ! final TypeConstructor[] vars, ! final boolean[] all) { for(int act = 0; act<kinds.length;act++) *************** *** 296,308 **** // Check if this is really a solution, because of // class constraints. ! for (int x = obs.getLowestSetBit(); ! x != BitVector.UNDEFINED_INDEX; ! x = obs.getNextBit(x)) ! { ! TypeConstructor var,sol; ! var=(TypeConstructor) kind.getElement(x); ! sol=(TypeConstructor) kind.getElement(getSolutionOf(x)); ! int index = var.enumerateTagIndex; ! if (! checkClassConstraint(tags[index], sol)) return; } --- 305,330 ---- // Check if this is really a solution, because of // class constraints. ! for (int index = 0; index < vars.length; index++) ! { ! /* If this index does not need all solutions ! (i.e. all[index] is false), and the solution ! sol does not pass checkClassConstraint, ! it might have been that some other solution, which ! we don't generate, would pass. So in this case ! we should restart to try other solutions for this ! index to see if at least one passes or not. ! */ ! ! TypeConstructor var,solution; ! var = vars[index]; ! ! // We only deal with matchable tags, ! // and those that belong to this kind. ! if (var == null || var.getKind() != kind) ! continue; ! ! solution = (TypeConstructor) ! kind.getElement(getSolutionOf(var.getId())); ! if (! checkClassConstraint(tags[index], solution)) return; } *************** *** 310,321 **** // It is a solution, let's add it to the list. tuples.startEntry(); ! for (int x = obs.getLowestSetBit(); ! x != BitVector.UNDEFINED_INDEX; ! x = obs.getNextBit(x)) { ! TypeConstructor var,sol; ! var=(TypeConstructor) kind.getElement(x); ! sol=(TypeConstructor) kind.getElement(getSolutionOf(x)); ! tuples.set(var.enumerateTagIndex, sol); } } --- 332,348 ---- // It is a solution, let's add it to the list. tuples.startEntry(); ! for (int index = 0; index < vars.length; index++) { ! TypeConstructor var, solution; ! var = vars[index]; ! ! // We only deal with matchable tags, ! // and those that belong to this kind. ! if (var == null || var.getKind() != kind) ! continue; ! ! solution = (TypeConstructor) ! kind.getElement(getSolutionOf(var.getId())); ! tuples.set(index, solution); } } |
From: <bo...@us...> - 2004-02-24 17:43:16
|
Update of /cvsroot/nice/Nice/src/gnu/bytecode In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv4180/src/gnu/bytecode Modified Files: ObjectType.java Log Message: Throw a more characteristic exception when a needed class is missing, so that we can print an appropriate error message. Index: ObjectType.java =================================================================== RCS file: /cvsroot/nice/Nice/src/gnu/bytecode/ObjectType.java,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** ObjectType.java 9 Sep 2002 12:59:26 -0000 1.7 --- ObjectType.java 24 Feb 2004 17:36:43 -0000 1.8 *************** *** 60,64 **** if (reflectClass == null && (flags & EXISTING_CLASS) != 0) ! throw new RuntimeException("no such class: "+getName()); return reflectClass; --- 60,64 ---- if (reflectClass == null && (flags & EXISTING_CLASS) != 0) ! throw new NoClassDefFoundError(getName()); return reflectClass; |
From: <ar...@us...> - 2004-02-24 16:11:31
|
Update of /cvsroot/nice/Nice/stdlib/nice/lang In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv15440/F:/nice/stdlib/nice/lang Modified Files: collections.nice graph.nice java-io.nice native.nice null.nice prelude.nice Log Message: Removed the use of 'Any' from nice.lang. Index: collections.nice =================================================================== RCS file: /cvsroot/nice/Nice/stdlib/nice/lang/collections.nice,v retrieving revision 1.59 retrieving revision 1.60 diff -C2 -d -r1.59 -r1.60 *** collections.nice 19 Dec 2003 18:52:45 -0000 1.59 --- collections.nice 24 Feb 2004 16:04:56 -0000 1.60 *************** *** 270,274 **** Returns <code>null</code> if there is no such element. */ ! <Any T> ?T search (java.util.List<!T> list, !T->boolean test) { for (!T elem : list) --- 270,274 ---- Returns <code>null</code> if there is no such element. */ ! <T> ?T search (java.util.List<!T> list, !T->boolean test) { for (!T elem : list) Index: graph.nice =================================================================== RCS file: /cvsroot/nice/Nice/stdlib/nice/lang/graph.nice,v retrieving revision 1.20 retrieving revision 1.21 diff -C2 -d -r1.20 -r1.21 *** graph.nice 19 Nov 2003 16:04:45 -0000 1.20 --- graph.nice 24 Feb 2004 16:04:59 -0000 1.21 *************** *** 26,30 **** Tarjan's algorithm (linear). */ ! <Any T> List<List<T>> stronglyConnectedComponents(T start, T->List<T> successors) { --- 26,30 ---- Tarjan's algorithm (linear). */ ! <T> List<List<T>> stronglyConnectedComponents(T start, T->List<T> successors) { *************** *** 39,43 **** } ! <Any T> int visit(T node, T->List<T> successors, Ref<int> id, Stack<T> stack, Map<T,int> mark, List<List<T>> res) --- 39,43 ---- } ! <T> int visit(T node, T->List<T> successors, Ref<int> id, Stack<T> stack, Map<T,int> mark, List<List<T>> res) Index: java-io.nice =================================================================== RCS file: /cvsroot/nice/Nice/stdlib/nice/lang/java-io.nice,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** java-io.nice 26 Nov 2003 00:29:31 -0000 1.1 --- java-io.nice 24 Feb 2004 16:04:59 -0000 1.2 *************** *** 36,41 **** /** Convenience: printing on the standard output. */ ! <Any T> void print (T object) = System.out.print (object); ! <Any T> void println (T object) = System.out.println(object); // Constructors --- 36,41 ---- /** Convenience: printing on the standard output. */ ! <T> void print (T object) = System.out.print (object); ! <T> void println (T object) = System.out.println(object); // Constructors Index: native.nice =================================================================== RCS file: /cvsroot/nice/Nice/stdlib/nice/lang/native.nice,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** native.nice 19 Nov 2003 16:04:45 -0000 1.6 --- native.nice 24 Feb 2004 16:04:59 -0000 1.7 *************** *** 27,31 **** void `throw`(java.lang.Throwable exception) = inline nice.lang.inline.Throw(); ! <Any T> boolean `instanceof`(T value, Type) = inline nice.lang.inline.Instanceof(); --- 27,31 ---- void `throw`(java.lang.Throwable exception) = inline nice.lang.inline.Throw(); ! <T> boolean `instanceof`(T value, Type) = inline nice.lang.inline.Instanceof(); Index: null.nice =================================================================== RCS file: /cvsroot/nice/Nice/stdlib/nice/lang/null.nice,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** null.nice 19 Nov 2003 16:04:45 -0000 1.5 --- null.nice 24 Feb 2004 16:04:59 -0000 1.6 *************** *** 30,33 **** Otherwise evaluate e2 and return it. */ ! <Any T> !T `||`(?T e1, !T e2) = inline nice.lang.inline.OptionOr(); ! <Any T> ?T `||`(?T e1, ?T e2) = inline nice.lang.inline.OptionOr(); --- 30,33 ---- Otherwise evaluate e2 and return it. */ ! <T> !T `||`(?T e1, !T e2) = inline nice.lang.inline.OptionOr(); ! <T> ?T `||`(?T e1, ?T e2) = inline nice.lang.inline.OptionOr(); Index: prelude.nice =================================================================== RCS file: /cvsroot/nice/Nice/stdlib/nice/lang/prelude.nice,v retrieving revision 1.36 retrieving revision 1.37 diff -C2 -d -r1.36 -r1.37 *** prelude.nice 12 Dec 2003 12:55:25 -0000 1.36 --- prelude.nice 24 Feb 2004 16:04:59 -0000 1.37 *************** *** 45,49 **** This should probably be fixed so that the semantics is well defined. */ ! <Any T> !T notNull(?T value) { assert(value != null); --- 45,49 ---- This should probably be fixed so that the semantics is well defined. */ ! <T> !T notNull(?T value) { assert(value != null); *************** *** 82,86 **** /** Unsafe cast operator. UNSAFE! */ ! <Any T, Any U> U cast(T) = inline nice.lang.inline.Nop(); /**************************************************************** --- 82,86 ---- /** Unsafe cast operator. UNSAFE! */ ! <T, U> U cast(T) = inline nice.lang.inline.Nop(); /**************************************************************** *************** *** 88,93 **** ****************************************************************/ ! <Any T> boolean `==`(T,T) = inline nice.lang.inline.ReferenceOp("=="); ! <Any T> boolean `!=`(T,T) = inline nice.lang.inline.ReferenceOp("!="); boolean `==`(char, char) = inline nice.lang.inline.CompOp("iEq"); --- 88,93 ---- ****************************************************************/ ! <T> boolean `==`(T,T) = inline nice.lang.inline.ReferenceOp("=="); ! <T> boolean `!=`(T,T) = inline nice.lang.inline.ReferenceOp("!="); boolean `==`(char, char) = inline nice.lang.inline.CompOp("iEq"); *************** *** 95,100 **** ! <Any T> boolean equals(!T,!T) = native boolean Object.equals(Object); ! <Any T> boolean equals(?T a, ?T b) { if (a != null && b != null) --- 95,100 ---- ! <T> boolean equals(!T,!T) = native boolean Object.equals(Object); ! <T> boolean equals(?T a, ?T b) { if (a != null && b != null) *************** *** 106,118 **** <T> int hashCode(!T) = native int Object.hashCode(); ! <Any T> String toString(!T) = native String Object.toString(); ! <Any T> String valueOf(T) = native String String.valueOf(Object); ! <Any T> Class getClass(!T) = native Class Object.getClass(); ! <Any T> void wait(!T) = native void Object.wait(); ! <Any T> void wait(!T, long) = native void Object.wait(long); ! <Any T> void wait(!T, long, int) = native void Object.wait(long, int); ! <Any T> void notify(!T) = native void Object.notify(); ! <Any T> void notifyAll(!T) = native void Object.notifyAll(); /** --- 106,118 ---- <T> int hashCode(!T) = native int Object.hashCode(); ! <T> String toString(!T) = native String Object.toString(); ! <T> String valueOf(T) = native String String.valueOf(Object); ! <T> Class getClass(!T) = native Class Object.getClass(); ! <T> void wait(!T) = native void Object.wait(); ! <T> void wait(!T, long) = native void Object.wait(long); ! <T> void wait(!T, long, int) = native void Object.wait(long, int); ! <T> void notify(!T) = native void Object.notify(); ! <T> void notifyAll(!T) = native void Object.notifyAll(); /** |
From: <ar...@us...> - 2004-02-24 15:56:51
|
Update of /cvsroot/nice/Nice/src/bossa/syntax In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv11357/F:/nice/src/bossa/syntax Modified Files: Constraint.java Log Message: Don't print 'Any' in .nicei Index: Constraint.java =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/syntax/Constraint.java,v retrieving revision 1.38 retrieving revision 1.39 diff -C2 -d -r1.38 -r1.39 *** Constraint.java 22 Dec 2003 20:28:10 -0000 1.38 --- Constraint.java 24 Feb 2004 15:50:19 -0000 1.39 *************** *** 134,138 **** { if(atomics.size()==0) ! return Util.map("<Any ",", Any ","> ",binders); else if(binders.size()==0) return Util.map("<",", ","> ",atomics); --- 134,138 ---- { if(atomics.size()==0) ! return Util.map("<",", ","> ",binders); else if(binders.size()==0) return Util.map("<",", ","> ",atomics); *************** *** 197,201 **** } ! res.append(Util.map((res.length()>1 ? ", " : "") + "Any ",", Any ","", c.binders)); res.append(Util.map(" | ",", ","",c.atomics)).append("> "); --- 197,201 ---- } ! res.append(Util.map((res.length()>1 ? ", " : ""),", ","", c.binders)); res.append(Util.map(" | ",", ","",c.atomics)).append("> "); |