nice-commit Mailing List for The Nice Programming Language (Page 116)
Brought to you by:
bonniot
You can subscribe to this list here.
2003 |
Jan
|
Feb
(60) |
Mar
(125) |
Apr
(183) |
May
(140) |
Jun
(227) |
Jul
(141) |
Aug
(181) |
Sep
(75) |
Oct
(89) |
Nov
(187) |
Dec
(162) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2004 |
Jan
(69) |
Feb
(197) |
Mar
(98) |
Apr
(26) |
May
(10) |
Jun
(85) |
Jul
(88) |
Aug
(79) |
Sep
(80) |
Oct
(81) |
Nov
(53) |
Dec
(109) |
2005 |
Jan
(68) |
Feb
(77) |
Mar
(232) |
Apr
(79) |
May
(37) |
Jun
(37) |
Jul
(3) |
Aug
(18) |
Sep
|
Oct
|
Nov
|
Dec
|
2006 |
Jan
(10) |
Feb
|
Mar
(4) |
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
(2) |
Nov
(1) |
Dec
(9) |
2007 |
Jan
(2) |
Feb
(8) |
Mar
(2) |
Apr
(5) |
May
|
Jun
|
Jul
|
Aug
(4) |
Sep
|
Oct
|
Nov
(17) |
Dec
(6) |
2008 |
Jan
|
Feb
(3) |
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
2011 |
Jan
|
Feb
|
Mar
|
Apr
(1) |
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
From: <bo...@us...> - 2003-04-24 13:05:01
|
Update of /cvsroot/nice/Nice/web In directory sc8-pr-cvs1:/tmp/cvs-serv30142/web Modified Files: manual.xsl Log Message: Removed unused entity declarations. Index: manual.xsl =================================================================== RCS file: /cvsroot/nice/Nice/web/manual.xsl,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** manual.xsl 23 Apr 2003 15:59:15 -0000 1.1 --- manual.xsl 24 Apr 2003 13:04:57 -0000 1.2 *************** *** 12,16 **** --> ! <!DOCTYPE xsl:stylesheet [ <!ENTITY nbsp " "> <!ENTITY quest "?"> ]> <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version='1.0' --- 12,16 ---- --> ! <!DOCTYPE xsl:stylesheet> <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version='1.0' |
From: <bo...@us...> - 2003-04-24 12:32:22
|
Update of /cvsroot/nice/Nice/src/bossa/syntax In directory sc8-pr-cvs1:/tmp/cvs-serv17053/src/bossa/syntax Modified Files: analyse.nice Log Message: Typo. Index: analyse.nice =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/syntax/analyse.nice,v retrieving revision 1.58 retrieving revision 1.59 diff -C2 -d -r1.58 -r1.59 *** analyse.nice 5 Apr 2003 11:32:24 -0000 1.58 --- analyse.nice 24 Apr 2003 12:32:17 -0000 1.59 *************** *** 283,287 **** if ((! e.hasBrackets) && (arity == 0)) ! // This case is link java.lang.Byte.toString: // look for a method with that name and any arity, // since the method is not called but just referenced. --- 283,287 ---- if ((! e.hasBrackets) && (arity == 0)) ! // This case is like java.lang.Byte.toString: // look for a method with that name and any arity, // since the method is not called but just referenced. |
From: <bo...@us...> - 2003-04-24 12:29:49
|
Update of /cvsroot/nice/Nice/src/bossa/syntax In directory sc8-pr-cvs1:/tmp/cvs-serv15796/src/bossa/syntax Modified Files: typecheck.nice Log Message: Fixed overloaded symbols used inside a || or && expression. Index: typecheck.nice =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/syntax/typecheck.nice,v retrieving revision 1.57 retrieving revision 1.58 diff -C2 -d -r1.57 -r1.58 *** typecheck.nice 5 Apr 2003 11:32:23 -0000 1.57 --- typecheck.nice 24 Apr 2003 12:29:42 -0000 1.58 *************** *** 117,121 **** typecheck(args.getExp(1)); ! args.getExp(1).getType(); } finally { --- 117,125 ---- typecheck(args.getExp(1)); ! if (l != null) { ! Expression e = args.getExp(1).noOverloading(); ! args.setExp(1, e); ! e.getType(); ! } } finally { *************** *** 148,152 **** typecheck(args.getExp(1)); ! args.getExp(1).getType(); } finally { --- 152,160 ---- typecheck(args.getExp(1)); ! if (l != null) { ! Expression e = args.getExp(1).noOverloading(); ! args.setExp(1, e); ! e.getType(); ! } } finally { |
From: <bo...@us...> - 2003-04-24 12:29:47
|
Update of /cvsroot/nice/Nice/testsuite/compiler/overloading In directory sc8-pr-cvs1:/tmp/cvs-serv15796/testsuite/compiler/overloading Added Files: resolution.testsuite Log Message: Fixed overloaded symbols used inside a || or && expression. --- NEW FILE: resolution.testsuite --- /// PASS /// Toplevel class A { boolean foo; boolean getFoo(boolean other) = other || foo; } int foo() = 42; /// PASS /// Toplevel class A { boolean foo; boolean getFoo(boolean other) = foo || other; } int foo() = 42; /// PASS /// Toplevel class A { boolean foo; boolean getFoo(boolean other) = other && foo; } int foo() = 42; /// PASS /// Toplevel class A { boolean foo; boolean getFoo(boolean other) = foo && other; } int foo() = 42; /// PASS /// Toplevel class A { boolean foo; boolean getFoo(?String s) = (s == null) || foo; } int foo() = 42; /// PASS /// Toplevel class A { boolean foo; boolean getFoo(?String s) = (s != null) && foo; } int foo() = 42; |
From: <bo...@us...> - 2003-04-24 12:21:30
|
Update of /cvsroot/nice/Nice/src/bossa/syntax In directory sc8-pr-cvs1:/tmp/cvs-serv12246/src/bossa/syntax Modified Files: OverloadedSymbolExp.java Log Message: Clarified the precedence of field access. Index: OverloadedSymbolExp.java =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/syntax/OverloadedSymbolExp.java,v retrieving revision 1.50 retrieving revision 1.51 diff -C2 -d -r1.50 -r1.51 *** OverloadedSymbolExp.java 23 Mar 2003 23:03:03 -0000 1.50 --- OverloadedSymbolExp.java 24 Apr 2003 12:21:26 -0000 1.51 *************** *** 253,256 **** --- 253,257 ---- return uniqueExpression(); + // Field access has precedence over method call. List fieldAccesses = filterFieldAccesses(); if (fieldAccesses.size() != 0) |
From: <ar...@us...> - 2003-04-23 21:47:18
|
Update of /cvsroot/nice/Nice/testsuite/lib/java/util In directory sc8-pr-cvs1:/tmp/cvs-serv27668/F:/nice/testsuite/lib/java/util Modified Files: collections.testsuite Log Message: Added co\contra-variant retypings to collection methods. Index: collections.testsuite =================================================================== RCS file: /cvsroot/nice/Nice/testsuite/lib/java/util/collections.testsuite,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** collections.testsuite 27 Mar 2003 21:38:40 -0000 1.8 --- collections.testsuite 23 Apr 2003 21:46:06 -0000 1.9 *************** *** 37,38 **** --- 37,72 ---- assert list[0] == "A"; assert list[1] == "BA"; + + /// PASS + List<B> list = new ArrayList(); + B b = new B(); + list.add(b); + A obj = b; + assert(list.contains(obj)); + /// Toplevel + class A{} + class B extends A{} + + /// FAIL + List<B> list = new ArrayList(); + A obj = new A(); + list.contains(obj); + /// Toplevel + class A{} + class B{} + + /// PASS + /// Toplevel + <T,U,V | U <: T, V <: T> Set<T> intersection(Set<U>, Set<V>); + + intersection<T,U,V>(s1@Set, s2@Set) { + Set<T> res = new HashSet(); + if (s1.size() < s2.size()) { + for(U elem : s1) + if (s2.contains(elem)) res.add(elem); + } else { + for(V elem : s2) + if (s1.contains(elem)) res.add(elem); + } + return res; + } |
From: <ar...@us...> - 2003-04-23 21:46:40
|
Update of /cvsroot/nice/Nice/stdlib/nice/lang In directory sc8-pr-cvs1:/tmp/cvs-serv27668/F:/nice/stdlib/nice/lang Modified Files: java.nice Log Message: Added co\contra-variant retypings to collection methods. Index: java.nice =================================================================== RCS file: /cvsroot/nice/Nice/stdlib/nice/lang/java.nice,v retrieving revision 1.19 retrieving revision 1.20 diff -C2 -d -r1.19 -r1.20 *** java.nice 27 Mar 2003 21:38:39 -0000 1.19 --- java.nice 23 Apr 2003 21:46:04 -0000 1.20 *************** *** 101,120 **** <T, U | U <: T> boolean addAll(Collection<T>, Collection<U>) = native boolean java.util.Collection.addAll(java.util.Collection); ! // Some methods use Object, when they should use a type variable. ! <E> boolean contains(java.util.Collection<E>, E) = native boolean java.util.Collection.contains(Object); ! <E> boolean remove(java.util.Collection<E>, E) = native boolean java.util.Collection.remove(Object); ! <E> int indexOf(java.util.List<E>, E) = native int java.util.List.indexOf(Object); ! <E> int lastIndexOf(java.util.List<E>, E) = native int java.util.List.lastIndexOf(Object); ! <E> int lastIndexOf(java.util.Vector<E>, E, int) = native int java.util.Vector.lastIndexOf(Object, int); ! <E> boolean removeElement(java.util.Vector<E>, E) = native boolean java.util.Vector.removeElement(Object); ! <E> int search(java.util.Stack<E>, E) = native int java.util.Stack.search(Object); --- 101,128 ---- <T, U | U <: T> boolean addAll(Collection<T>, Collection<U>) = native boolean java.util.Collection.addAll(java.util.Collection); + <T, U | U <: T> boolean addAll(List<T>, int, Collection<U>) = + native boolean java.util.List.addAll(int, java.util.Collection); ! <T, U | T <: U> boolean containsAll(Collection<T>, Collection<U>) = ! native boolean java.util.Collection.containsAll(java.util.Collection); ! <T, U | T <: U> boolean removeAll(Collection<T>, Collection<U>) = ! native boolean java.util.Collection.removeAll(java.util.Collection); ! <T, U | T <: U> boolean retainAll(Collection<T>, Collection<U>) = ! native boolean java.util.Collection.retainAll(java.util.Collection); ! ! <E,T | E <: T> boolean contains(java.util.Collection<E>, T) = native boolean java.util.Collection.contains(Object); ! <E,T | E <: T> boolean remove(java.util.Collection<E>, T) = native boolean java.util.Collection.remove(Object); ! <E,T | E <: T> int indexOf(java.util.List<E>, T) = native int java.util.List.indexOf(Object); ! <E,T | E <: T> int lastIndexOf(java.util.List<E>, T) = native int java.util.List.lastIndexOf(Object); ! <E,T | E <: T> int lastIndexOf(java.util.Vector<E>, T, int) = native int java.util.Vector.lastIndexOf(Object, int); ! <E,T | E <: T> boolean removeElement(java.util.Vector<E>, T) = native boolean java.util.Vector.removeElement(Object); ! <E,T | E <: T> int search(java.util.Stack<E>, T) = native int java.util.Stack.search(Object); *************** *** 127,150 **** //retypings for Maps ! <Key, Element> boolean containsKey(Map<Key, Element>, Key) = native boolean java.util.Map.containsKey(Object); // The results can be null even if the value type is non-optional. ! <K, V0, V | V <: ?V0> ?V0 remove(java.util.Map<K, V>, K)= native Object java.util.Map.remove(Object); ! <K, V0, V | V <: ?V0> ?V0 get(java.util.Map<K, V>, K)= native Object java.util.Map.get(Object); <K, V0, V | V <: ?V0> ?V0 put(java.util.Map<K, V>, K, V)= native Object java.util.Map.put(Object, Object); ! <K, V> boolean containsValue(java.util.Map<K, V>, V) = native boolean java.util.Map.containsValue(Object); ! <K, V> java.util.Set<K> keySet(java.util.Map<K, V>) = native java.util.Set java.util.Map.keySet(); ! <K, V> java.util.Collection<V> values(java.util.Map<K, V>) = native java.util.Collection java.util.Map.values(); ! <K, V> java.util.Set<java.util.Map.Entry<K, V>> entrySet(java.util.Map<K, V>) = native java.util.Set java.util.Map.entrySet(); ! <K,V> boolean contains(java.util.Hashtable<K,V>, V) = native boolean java.util.Hashtable.contains(Object); --- 135,161 ---- //retypings for Maps ! <K, K0, V | K <: K0> boolean containsKey(Map<K, V>, K0) = native boolean java.util.Map.containsKey(Object); // The results can be null even if the value type is non-optional. ! <K, K0, V0, V | K <: K0, V <: ?V0> ?V0 remove(java.util.Map<K, V>, K0)= native Object java.util.Map.remove(Object); ! <K, K0, V0, V | K <: K0, V <: ?V0> ?V0 get(java.util.Map<K, V>, K0)= native Object java.util.Map.get(Object); <K, V0, V | V <: ?V0> ?V0 put(java.util.Map<K, V>, K, V)= native Object java.util.Map.put(Object, Object); ! <K, K0, V0, V | K0 <: K, V0 <: V> void putAll(java.util.Map<K, V>, java.util.Map<K0, V0>)= ! native void java.util.Map.putAll(java.util.Map); ! ! <K, V, V0 | V <: V0> boolean containsValue(java.util.Map<K, V>, V0) = native boolean java.util.Map.containsValue(Object); ! <K, K0, V | K <: K0> java.util.Set<K0> keySet(java.util.Map<K, V>) = native java.util.Set java.util.Map.keySet(); ! <K, V, V0 | V <: V0> java.util.Collection<V0> values(java.util.Map<K, V>) = native java.util.Collection java.util.Map.values(); ! <K, K0, V, V0 | K <: K0, V <: V0> java.util.Set<java.util.Map.Entry<K0, V0>> entrySet(java.util.Map<K, V>) = native java.util.Set java.util.Map.entrySet(); ! <K, V, V0 | V <: V0> boolean contains(java.util.Hashtable<K,V>, V0) = native boolean java.util.Hashtable.contains(Object); |
From: <bo...@us...> - 2003-04-23 20:01:41
|
Update of /cvsroot/nice/swing/src/nice/ui/common/types/swing In directory sc8-pr-cvs1:/tmp/cvs-serv9340/src/nice/ui/common/types/swing Modified Files: java.nice Log Message: Started to add retypings for the JOptionPane class. Index: java.nice =================================================================== RCS file: /cvsroot/nice/swing/src/nice/ui/common/types/swing/java.nice,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** java.nice 2 Oct 2002 03:21:23 -0000 1.3 --- java.nice 23 Apr 2003 20:01:36 -0000 1.4 *************** *** 542,544 **** = native void ScrollPane.addImpl(Component, Object, int); void setScrollPosition(ScrollPane, Point) ! = native void ScrollPane.setScrollPosition(Point); \ No newline at end of file --- 542,562 ---- = native void ScrollPane.addImpl(Component, Object, int); void setScrollPosition(ScrollPane, Point) ! = native void ScrollPane.setScrollPosition(Point); ! ! // class JOptionPane (not complete). ! <T> String showInternalInputDialog(Component parentComponent, T message) ! = native String JOptionPane.showInternalInputDialog(Component, Object); ! <T> String showInternalInputDialog(Component parentComponent, T message, String title, int messageType) ! = native String JOptionPane.showInternalInputDialog(Component, Object, String, int); ! <T> void showInternalMessageDialog(Component parentComponent, T message) ! = native void JOptionPane.showInternalMessageDialog(Component, Object); ! <T> void showInternalMessageDialog(Component parentComponent, T message, String title, int messageType) ! = native void JOptionPane.showInternalMessageDialog(Component, Object, String, int); ! <T> void showInternalMessageDialog(Component parentComponent, T message, String title, int messageType, Icon icon) ! = native void JOptionPane.showInternalMessageDialog(Component, Object, String, int, Icon); ! <T> void showMessageDialog(Component parentComponent, T message) ! = native void JOptionPane.showMessageDialog(Component, Object); ! <T> void showMessageDialog(Component parentComponent, T message, String title, int messageType) ! = native void JOptionPane.showMessageDialog(Component, Object, String, int); ! <T> void showMessageDialog(Component parentComponent, T message, String title, int messageType, Icon icon) ! = native void JOptionPane.showMessageDialog(Component, Object, String, int, Icon); |
From: <bo...@us...> - 2003-04-23 19:58:47
|
Update of /cvsroot/nice/swing/src/nice/ui/common In directory sc8-pr-cvs1:/tmp/cvs-serv8014/src/nice/ui/common Modified Files: BeanListener.nice Log Message: Made NiceBeanContextServicesListener extend NiceBeanContextServiceRevokedListener. Index: BeanListener.nice =================================================================== RCS file: /cvsroot/nice/swing/src/nice/ui/common/BeanListener.nice,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** BeanListener.nice 13 Nov 2002 02:22:28 -0000 1.4 --- BeanListener.nice 23 Apr 2003 19:58:40 -0000 1.5 *************** *** 92,96 **** ! class NiceBeanContextServicesListener implements BeanContextServicesListener, NiceListener { private BeanContextServiceAvailableEvent ?-> void serviceAvailable; --- 92,98 ---- ! class NiceBeanContextServicesListener ! extends NiceBeanContextServiceRevokedListener ! implements BeanContextServicesListener { private BeanContextServiceAvailableEvent ?-> void serviceAvailable; |
From: <ar...@us...> - 2003-04-23 19:57:03
|
Update of /cvsroot/nice/Nice/testsuite/compiler/methods In directory sc8-pr-cvs1:/tmp/cvs-serv7088/F:/nice/testsuite/compiler/methods Modified Files: nativeOverride.testsuite Log Message: Give error when implementing Java methods on interfaces. Index: nativeOverride.testsuite =================================================================== RCS file: /cvsroot/nice/Nice/testsuite/compiler/methods/nativeOverride.testsuite,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** nativeOverride.testsuite 18 Apr 2003 14:50:18 -0000 1.3 --- nativeOverride.testsuite 23 Apr 2003 19:56:58 -0000 1.4 *************** *** 186,187 **** --- 186,191 ---- intValue() = 0; } + + /// FAIL + interface I{} + equals(x@I,y@I) = true; |
From: <ar...@us...> - 2003-04-23 19:57:03
|
Update of /cvsroot/nice/Nice/src/bossa/syntax In directory sc8-pr-cvs1:/tmp/cvs-serv7088/F:/nice/src/bossa/syntax Modified Files: MethodBodyDefinition.java Log Message: Give error when implementing Java methods on interfaces. Index: MethodBodyDefinition.java =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/syntax/MethodBodyDefinition.java,v retrieving revision 1.116 retrieving revision 1.117 diff -C2 -d -r1.116 -r1.117 *** MethodBodyDefinition.java 18 Apr 2003 14:50:23 -0000 1.116 --- MethodBodyDefinition.java 23 Apr 2003 19:56:57 -0000 1.117 *************** *** 136,141 **** this.declaration = d; ! if (d instanceof JavaMethod) ((JavaMethod) d).registerForDispatch(); else if (! (d instanceof NiceMethod)) User.error(this, "Implementations can only be made for methods, but " + --- 136,144 ---- this.declaration = d; ! if (d instanceof JavaMethod) { ((JavaMethod) d).registerForDispatch(); + if (TypeConstructors.isInterface(formals[0].tc)) + User.error(this, name + " is a native method. Dispatch can only occur if the first argument is not a interface."); + } else if (! (d instanceof NiceMethod)) User.error(this, "Implementations can only be made for methods, but " + |
From: <bo...@us...> - 2003-04-23 15:59:18
|
Update of /cvsroot/nice/Nice/web In directory sc8-pr-cvs1:/tmp/cvs-serv18678/web Added Files: manual.xsl Log Message: Made a stylesheet for the manual, so that the output can be customized. Additionally, this renders the Makefile more portable. --- NEW FILE: manual.xsl --- <?xml version='1.0'?> <!-- Stylesheet for the Nice User's Manual. This is based on the dookbook XSL stylesheets. Currently, it just overrides the translation of <type> elements, to make them rendered in a monospace font. Other customisations can be done in this file if necessary. --> <!DOCTYPE xsl:stylesheet [ <!ENTITY nbsp " "> <!ENTITY quest "?"> ]> <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version='1.0' xmlns="http://www.w3.org/TR/xhtml1/transitional" exclude-result-prefixes="#default"> <xsl:import href="http://docbook.sourceforge.net/release/xsl/current/html/docbook.xsl"/> <xsl:template match="type"> <xsl:call-template name="inline.monoseq"/> </xsl:template> </xsl:stylesheet> |
From: <bo...@us...> - 2003-04-23 15:57:12
|
Update of /cvsroot/nice/Nice/web In directory sc8-pr-cvs1:/tmp/cvs-serv17747/web Modified Files: Makefile Log Message: Made a stylesheet for the manual, so that the output can be customized. Additionally, this renders the Makefile more portable. Index: Makefile =================================================================== RCS file: /cvsroot/nice/Nice/web/Makefile,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** Makefile 22 Jun 2002 16:19:01 -0000 1.7 --- Makefile 23 Apr 2003 15:57:09 -0000 1.8 *************** *** 1,7 **** PROC=xsltproc --nonet - STYLEDIR=/usr/share/sgml/docbook/custom/website/2.0b1/xsl STYLESHEET=common.xsl STYLEOPT= - DOCBK=/usr/share/sgml/docbook/stylesheet/xsl/nwalsh/html/docbook.xsl .PHONY : clean send --- 1,5 ---- *************** *** 15,20 **** old: safety.html ! manual.html: manual.xml $(DOCBK) ! $(PROC) $(DOCBK) manual.xml > $@ %.html: %.xml new.xsl --- 13,18 ---- old: safety.html ! manual.html: manual.xsl manual.xml ! $(PROC) manual.xsl manual.xml > $@ %.html: %.xml new.xsl |
From: <bo...@us...> - 2003-04-23 15:50:53
|
Update of /cvsroot/nice/Nice/web In directory sc8-pr-cvs1:/tmp/cvs-serv14943/web Modified Files: manual.xml Log Message: Updated the syntax definitions, to make better use of Docbook features like <optional> and <replaceable>, and thus get a more unified look, more easily configurable. Reworked the information on option types. Various minor fixes. Index: manual.xml =================================================================== RCS file: /cvsroot/nice/Nice/web/manual.xml,v retrieving revision 1.16 retrieving revision 1.17 diff -C2 -d -r1.16 -r1.17 *** manual.xml 23 Apr 2003 10:36:43 -0000 1.16 --- manual.xml 23 Apr 2003 15:50:50 -0000 1.17 *************** *** 15,18 **** --- 15,19 ---- <title>The Nice user's manual</title> <author><firstname>Daniel</firstname><surname>Bonniot</surname></author> + <author><firstname>Bryn</firstname><surname>Keller</surname></author> <copyright><year>2003</year><holder>Daniel Bonniot</holder></copyright> </bookinfo> *************** *** 98,102 **** </para> <para> ! <literal>package</literal> package-name<literal>;</literal> </para> <para> --- 99,103 ---- </para> <para> ! <literal>package <replaceable>package-name</replaceable>;</literal> </para> <para> *************** *** 105,109 **** </para> <para> ! <literal>import</literal> package-name<literal>;</literal> </para> <para> --- 106,110 ---- </para> <para> ! <literal>import <replaceable>package-name</replaceable>;</literal> </para> <para> *************** *** 142,146 **** The syntax for field declaration is: <programlisting> ! <type>Type</type> fieldName<optional> = initialValue</optional>; </programlisting> If no default value is given, then every call to the constructor --- 143,147 ---- The syntax for field declaration is: <programlisting> ! <type><replaceable>type</replaceable></type> <replaceable>field-name</replaceable><optional> = <replaceable>initial-value</replaceable></optional>; </programlisting> If no default value is given, then every call to the constructor *************** *** 287,297 **** </example> <para> ! In the Nice version, we've parameterized <classname>Stack</classname> by ! a type <type>T</type>. Essentially, <classname>Stack<T></classname> ! is a recipe for the compiler that tells it how to create a Stack that works for any given type. So now the compiler knows that we only mean for Strings to go into our stack, and it reports an error when we ! write code that expects an Integer to come out of our ! <classname>Stack<String></classname>. </para> </section> --- 288,299 ---- </example> <para> ! In the Nice version, we have parameterized <classname>Stack</classname> by ! a type <type>T</type>. Essentially, <type>Stack<T></type> ! is a recipe for the compiler that tells it how to create a ! <classname>Stack</classname> that works for any given type. So now the compiler knows that we only mean for Strings to go into our stack, and it reports an error when we ! write code that expects an <type>Integer</type> to come out of our ! <type>Stack<String></type>. </para> </section> *************** *** 324,340 **** <para> ! <literal>[type-parameters] return-type ! function-name([parameters]) &LBRACE; body &RBRACE;</literal> </para> <para> ! Where <literal>[parameters]</literal> and ! <literal>[type-parameters]</literal> are optional. There is a also ! a special case for functions whose body consists of a single expression: </para> <para> ! <literal>[type-parameters] return-type function-name([parameters]) ! = expression;</literal> </para> --- 326,351 ---- <para> ! <literal> ! <optional><replaceable>type-parameters</replaceable></optional> ! <replaceable>return-type</replaceable> ! <replaceable>function-name</replaceable> ! (<optional><replaceable>parameters</replaceable></optional>) ! &LBRACE; <replaceable>body</replaceable> &RBRACE; ! </literal> </para> <para> ! There is a also a simpler syntax for functions whose body ! consists of a single expression: </para> <para> ! <literal> ! <optional><replaceable>type-parameters</replaceable></optional> ! <replaceable>return-type</replaceable> ! <replaceable>function-name</replaceable> ! (<optional><replaceable>parameters</replaceable></optional>) ! = <replaceable>expression</replaceable>; ! </literal> </para> *************** *** 396,400 **** <para> <literal> T[] slice(T[] array, int from = 0, ! int to = array.length - 1);</literal>. </para> </section> --- 407,411 ---- <para> <literal> T[] slice(T[] array, int from = 0, ! int to = array.length - 1);</literal> </para> </section> *************** *** 408,418 **** <para> ! <literal>[type-parameters] return-type ! method-name([parameters]);</literal> </para> <para> ! The syntax is very similar to that for functions, but no body is ! provided. Note that in Nice, methods can be defined within the body of a class definition, or outside of it - both are identical for the compiler's purposes. --- 419,434 ---- <para> ! <literal> ! <optional><replaceable>type-parameters</replaceable></optional> ! <replaceable>return-type</replaceable> ! <replaceable>method-name</replaceable> ! (<optional><replaceable>parameters</replaceable></optional>); ! </literal> </para> <para> ! The syntax is very similar to that for functions, except that ! no body is provided. ! Note that in Nice, methods can be defined within the body of a class definition, or outside of it - both are identical for the compiler's purposes. *************** *** 426,430 **** <para> ! method-name([arguments]) &LBRACE; body &RBRACE; </para> --- 442,450 ---- <para> ! <literal> ! <replaceable>method-name</replaceable> ! (<optional><replaceable>arguments</replaceable></optional>) ! &LBRACE; body &RBRACE; ! </literal> </para> *************** *** 432,445 **** <para> ! method-name([arguments]) = expression; </para> <para> ! The <literal>[arguments]</literal> consist of names, and optionally ! types, of the form </para> <para> ! <literal>name</literal> </para> --- 452,469 ---- <para> ! <literal> ! <replaceable>method-name</replaceable> ! (<optional><replaceable>arguments</replaceable></optional>) ! = <replaceable>expression</replaceable>; ! </literal> </para> <para> ! The <optional><replaceable>arguments</replaceable></optional> ! consist of names, and optionally types, of the form </para> <para> ! <literal><replaceable>name</replaceable></literal> </para> *************** *** 447,456 **** <para> ! <literal>name@type</literal> </para> <para> ! The <literal>@type</literal> is used to specialize the method on that ! argument. An example should make the difference clear. Also note the use of both the block- and expression-style methods. </para> --- 471,481 ---- <para> ! <literal><replaceable>name</replaceable>@<replaceable>class-name</replaceable></literal> </para> <para> ! The <literal>@<replaceable>class-name</replaceable></literal> ! is used to specialize the method on that argument. ! An example should make the difference clear. Also note the use of both the block- and expression-style methods. </para> *************** *** 486,506 **** <para id="exactMatching"> It is also possible to specialize a method on the ! <emphasis>exact</emphasis> type of the argument. Then the method will ! apply to arguments which match the type exactly, and ! <emphasis>not</emphasis> to an argument which is a subtype of the type specified. The syntax for exact matching is: </para> <para> ! name<literal>#</literal>type </para> <para> When specializing a method with type parameters, it is not necessary ! or possible to restate the type parameters in the method implementation. However, if you need access to the type parameters as in the example below, use the syntax: </para> <para> ! <literal>method-name<type-parameters> (...) &LBRACE; body &RBRACE; ! </literal> </para> <example> --- 511,542 ---- <para id="exactMatching"> It is also possible to specialize a method on the ! <emphasis>exact</emphasis> class of the argument. Then the method will ! apply to arguments which match the class exactly, and ! <emphasis>not</emphasis> to an argument which is a subclass of the class specified. The syntax for exact matching is: </para> <para> ! <literal><replaceable>name</replaceable>#<replaceable>class-name</replaceable></literal> </para> + + <para> + There is an <link linkend="ex:copy">example</link> where + exact matching is required to + type-check a method with a precise polymorphic type. + </para> + <para> When specializing a method with type parameters, it is not necessary ! or possible to restate the type parameters in the method implementation. However, if you need access to the type parameters as in the example below, use the syntax: </para> <para> ! <literal> ! <replaceable>method-name</replaceable> ! <<replaceable>type-parameters</replaceable>> ! (<optional><replaceable>arguments</replaceable></optional>) ! &LBRACE; body &RBRACE; ! </literal> </para> <example> *************** *** 512,517 **** ! /* ! This version won't compile because the T type isn't in scope: lastItem(coll) --- 548,552 ---- ! /* This version won't compile because the T type isn't in scope: lastItem(coll) *************** *** 522,527 **** */ ! /* ! This one won't compile because Iterator needs a type argument: lastItem(coll) --- 557,561 ---- */ ! /* This one won't compile because Iterator needs a type argument: lastItem(coll) *************** *** 532,536 **** */ ! //This one will work correctly lastItem<T>(coll) { --- 566,570 ---- */ ! // This one will work correctly: lastItem<T>(coll) { *************** *** 538,544 **** //... } ! ! ]]> ! </programlisting> </example> <para> --- 572,576 ---- //... } ! ]]></programlisting> </example> <para> *************** *** 597,603 **** <para> For example, we can define the contract of the add method ! of a <literal>Buffer</literal> interface. ! It is guaranteed that <literal>isEmpty</literal> returns true ! if, and only if, <literal>size</literal> returns <literal>0</literal>. The <literal>add</literal> method can be called only when the buffer is not full. It is guaranteed to make the buffer non-empty, and --- 629,636 ---- <para> For example, we can define the contract of the add method ! of a <type>Buffer</type> interface. ! It is guaranteed that <literal>isEmpty</literal> returns ! <literal>true</literal> if, and only if, ! <literal>size</literal> returns <literal>0</literal>. The <literal>add</literal> method can be called only when the buffer is not full. It is guaranteed to make the buffer non-empty, and *************** *** 626,630 **** </section> ! <section><title>Enabling assertions and contract checking</title> <para> By default, assertions and contracts are not used at runtime. --- 659,663 ---- </section> ! <section id="enablingAssertions"><title>Enabling assertions and contract checking</title> <para> By default, assertions and contracts are not used at runtime. *************** *** 638,642 **** The mechanism is the same as for Java assertions. Checking can be enabled at runtime with ! <literal>java -ea ...</literal>. </para> </section> --- 671,675 ---- The mechanism is the same as for Java assertions. Checking can be enabled at runtime with ! <userinput>java -ea ...</userinput>. </para> </section> *************** *** 649,653 **** know the <literal>-ea</literal> command line option, they are disabled by default. You can enable them with ! <literal>java -Dassertions=true ...</literal>. </para> </section> --- 682,686 ---- know the <literal>-ea</literal> command line option, they are disabled by default. You can enable them with ! <userinput>java -Dassertions=true ...</userinput>. </para> </section> *************** *** 665,670 **** </para> <para> ! <literal>var</literal> type-name variable-name [= initializer] ! <literal>;</literal> </para> </section> --- 698,706 ---- </para> <para> ! <literal>var <replaceable>type</replaceable> ! <replaceable>variable-name</replaceable> ! <optional>= <replaceable>initial-value</replaceable></optional> ! ; ! </literal> </para> </section> *************** *** 738,746 **** <literal><![CDATA[<T> void foo(List<T>)]]></literal> are declared, and <literal>aList</literal> is an expression of static type ! <literal>List</literal>. The expression <literal>foo(aList)</literal> will result in calling the second <literal>foo</literal> function, ! because <literal>List</literal> ! is a subclass of <literal>Collection</literal>. </para> </footnote>. --- 774,782 ---- <literal><![CDATA[<T> void foo(List<T>)]]></literal> are declared, and <literal>aList</literal> is an expression of static type ! <type>List</type>. The expression <literal>foo(aList)</literal> will result in calling the second <literal>foo</literal> function, ! because <type>List</type> ! is a subclass of <type>Collection</type>. </para> </footnote>. *************** *** 769,774 **** <para> ! Tuple types are covariant, so a couple of <literal>int</literal>s ! can be used where a couple of <literal>long</literal>s is expected. </para> --- 805,810 ---- <para> ! Tuple types are covariant, so a couple of <type>int</type>s ! can be used where a couple of <type>long</type>s is expected. </para> *************** *** 802,806 **** printTuple(minMax(42, 41)); } ! }]]></programlisting> </example> --- 838,842 ---- printTuple(minMax(42, 41)); } ! ]]></programlisting> </example> *************** *** 818,822 **** </para> <para> ! ([parameters]) <literal>=></literal> &LBRACE; body &RBRACE; </para> <para> --- 854,861 ---- </para> <para> ! <literal> ! (<optional><replaceable>parameters</replaceable></optional>) ! => &LBRACE; body &RBRACE; ! </literal> </para> <para> *************** *** 824,828 **** </para> <para> ! ([parameters]) <literal>=></literal> expression </para> <para> --- 863,870 ---- </para> <para> ! <literal> ! (<optional><replaceable>parameters</replaceable></optional>) ! => <replaceable>expression</replaceable> ! </literal> </para> <para> *************** *** 855,860 **** return strings.foldLeft((String accum, String s) => accum + s, ""); } - - ]]></programlisting> </example> --- 897,900 ---- *************** *** 864,870 **** <para> The numeric primitive types are, from the largest to the smallest: ! <literal>double, float, long, int, short, byte</literal>, ! and <literal>char</literal> which is smaller than ! <literal>int</literal> but incomparable with <literal>short</literal>. Conversion from a smaller to a larger type is automatic. Conversion from a larger to a smaller type must be done explicitely, --- 904,910 ---- <para> The numeric primitive types are, from the largest to the smallest: ! <type>double, float, long, int, short, byte</type>, ! and <type>char</type> which is smaller than ! <type>int</type> but incomparable with <type>short</type>. Conversion from a smaller to a larger type is automatic. Conversion from a larger to a smaller type must be done explicitely, *************** *** 885,890 **** <para> For instance, here is code to read ! characters from a <literal>Reader</literal>, whose ! <literal>read</literal> method returns an <literal>int</literal> (<literal>-1</literal> meaning that the end of stream has been reached): --- 925,930 ---- <para> For instance, here is code to read ! characters from a <type>Reader</type>, whose ! <literal>read</literal> method returns an <type>int</type> (<literal>-1</literal> meaning that the end of stream has been reached): *************** *** 924,929 **** For instance, after a declaration <literal>import java.io.*;</literal> it is possible ! to refer to class <literal>java.io.File</literal> ! with the short name <literal>File</literal>. It is not possible to import only a single name, such as <literal>import java.io.File;</literal>, you must import the whole --- 964,969 ---- For instance, after a declaration <literal>import java.io.*;</literal> it is possible ! to refer to class <type>java.io.File</type> ! with the short name <type>File</type>. It is not possible to import only a single name, such as <literal>import java.io.File;</literal>, you must import the whole *************** *** 942,958 **** <para> Nice's advanced type system makes the distinction between normal ! (e.g. <literal>String</literal>) and option ! (e.g. <literal>?String</literal>) types, which allows to prevent <literal>NullPointerExceptions</literal> (see <link linkend="optionTypes">option types</link>). This poses a problem when using existing Java libraries. If my Nice program calls a Java function ! that returns a <literal>String</literal> (the Java type), ! does it mean <literal>String</literal> or ! <literal>?String</literal> in Nice? ! Since Java allows the value to be <literal>null</literal>, the Nice compiler ! currently suposes it's <literal>?String</literal> (it can only be ! sure about primitive types like <literal>int</literal>). </para> --- 982,998 ---- <para> Nice's advanced type system makes the distinction between normal ! (e.g. <type>String</type>) and option ! (e.g. <type>?String</type>) types, which allows to prevent <literal>NullPointerExceptions</literal> (see <link linkend="optionTypes">option types</link>). This poses a problem when using existing Java libraries. If my Nice program calls a Java function ! that returns a <type>String</type> (the Java type), ! does it mean <type>String</type> or ! <type>?String</type> in Nice? ! Since Java allows the value to be &NULL;, the Nice compiler ! currently suposes it's <type>?String</type> (it can only be ! sure about primitive types like <type>int</type>). </para> *************** *** 967,988 **** <para> In Nice, if <literal>myJavaClass</literal> is a variable of type ! <literal>MyJavaClass</literal>, then <literal>myJavaClass.getName()</literal> has type ! <literal>?String</literal>. </para> <para> ! If the Java code might indeed return <literal>null</literal>, or you are not sure, this is all good. To use the value you will ! have to test it against <literal>null</literal>. However there are many cases where you know the value cannot be ! <literal>null</literal>, for instance if this fact is specified in the Javadoc comment of the method. In that cases there are currently ! two possibilities. The first is to use the <literal>notNull</literal> ! function. It tells the compiler that you know the value is not ! <literal>null</literal>. At runtime, it will throw a ! <literal>NullPointerException</literal> if this was not the case. So in our example <literal>notNull(myJavaClass.getName())</literal> ! has type <literal>String</literal>. This solution is simple, but can be annoying if you call the same method many times, or because it makes your code less readable. --- 1007,1027 ---- <para> In Nice, if <literal>myJavaClass</literal> is a variable of type ! <type>MyJavaClass</type>, then <literal>myJavaClass.getName()</literal> has type ! <type>?String</type>. </para> <para> ! If the Java code might indeed return &NULL;, or you are not sure, this is all good. To use the value you will ! have to test it against &NULL;. However there are many cases where you know the value cannot be ! &NULL;, for instance if this fact is specified in the Javadoc comment of the method. In that cases there are currently ! two possibilities. The first is to use the ! <link linkend="notNull"><literal>notNull</literal> ! function</link>. So in our example <literal>notNull(myJavaClass.getName())</literal> ! has type <type>String</type>. This solution is simple, but can be annoying if you call the same method many times, or because it makes your code less readable. *************** *** 1001,1012 **** The Nice part (on the left of the <literal>=</literal> character) is the header of a function definition. Note that return type is ! <literal>String</literal> (without the optional type marker <literal>?</literal>). On the other hand, the right part says that the function is already defined in class ! <literal>MyJavaClass</literal>, with name <literal>getName</literal>, the one that takes no argument and returns a ! <literal>String</literal>. With this declaration, <literal>myJavaClass.getName()</literal> has type ! <literal>String</literal>. </para> </section> --- 1040,1051 ---- The Nice part (on the left of the <literal>=</literal> character) is the header of a function definition. Note that return type is ! <type>String</type> (without the optional type marker <literal>?</literal>). On the other hand, the right part says that the function is already defined in class ! <type>MyJavaClass</type>, with name <literal>getName</literal>, the one that takes no argument and returns a ! <type>String</type>. With this declaration, <literal>myJavaClass.getName()</literal> has type ! <type>String</type>. </para> </section> *************** *** 1173,1192 **** aren't &NULL; again, unless you actually want to allow &NULL;s. </para> <para> ! Two useful functions for dealing with nulls are ! <literal>notNull</literal> and <literal>cast</literal>. The ! <literal>notNull</literal> function is described above in the ! <link linkend="optionTypesJava">section on option types and Java ! code</link>. The <literal>cast</literal> function is used in those ! (rare) situations where it is necessary to allow a null where one ! shouldn't normally go, for instance if you need to declare a ! variable before entering a loop, but don't have a value to initialize ! it with. These situations are rare, and are usually the result of ! thinking about the problem in a Java way rather than a Nice way, ! but sometimes <literal>cast</literal> is the only way. </para> <para> ! For more details, see <ulink url="http://nice.sourceforge.net/cgi-bin/twiki/view/Doc/OptionTypes"> the Wiki page about option types</ulink>. --- 1212,1271 ---- aren't &NULL; again, unless you actually want to allow &NULL;s. </para> + + <section id="notNull"><title>The <literal>notNull</literal> function</title> + <para> + Sometimes, you know that a value cannot be &NULL;, + although it has an option type. + You can then use the <literal>notNull</literal> function to + assert this fact. + If an expression <replaceable>e</replaceable> has type + <type>?<replaceable>type</replaceable></type>, then + <literal>notNull(<replaceable>e</replaceable>)</literal> + has type <type>!<replaceable>type</replaceable></type>. + Note that if <replaceable>type</replaceable> is not a type + variable, <type>!<replaceable>type</replaceable></type> + is the same as <type><replaceable>type</replaceable></type>. + </para> + <para> + The <literal>notNull</literal> function uses + <link linkend="contracts"><literal>assert</literal></link> + to check that the argument is not &NULL;. + This means that the check will only happen at runtime + if <link linkend="enablingAssertions">assertion checks are + enabled</link>. + Otherwise, execution will continue, but the JVM will probably + fail soon afterwards with a <literal>NullPointerException</literal> + if the value is &NULL;, and it is used as + if it was not &NULL;. + </para> + </section> + + <para> + There are (rare) situations where it is necessary to allow a + &NULL; where one shouldn't normally go, for + instance if you need to declare a variable before entering a + loop, but don't have a value to initialize it with. + You should first try to think about an alternative way of + writing the code so that this is not needed. However, if there + is none, a solution is to use <literal>cast(null)</literal>. + This expression will be accepted in any context. + It is then your responsability to make sure that this value is + not used. + </para> + <para> ! Note that <literal>notNull</literal> and <literal>cast(null)</literal> ! have completely different uses. <literal>notNull</literal> is ! used to tell the compiler that you know a certain value is not ! &NULL;, although the type system does not guarantee it. ! On the other hand, <literal>cast(null)</literal> ! is used to provide a non-null value which is never going to be ! used. You could not use <literal>notNull(null)</literal> for ! that purpose, because this would fail at runtime if assertion ! checks are enabled. </para> <para> ! Additional information is available on <ulink url="http://nice.sourceforge.net/cgi-bin/twiki/view/Doc/OptionTypes"> the Wiki page about option types</ulink>. *************** *** 1197,1215 **** (<literal>!</literal>). This is used to specify a non-&NULL; type when it is not known if the original type allowed &NULL; or not. This ! generally happens with parameterized types, for instance the type </para> <para> ! <type><![CDATA[<T> T myFunction(Collection<T>)]]></type> </para> <para> ! can be instantiated at <emphasis>any</emphasis> type, including option types like <type>?String</type>. If it is necessary to exclude option types ! from the domain of T, the type is specified this way: </para> <para> ! <type><![CDATA[<!T> !T myFunction(Collection<!T>)]]></type>. </para> </section> <section id = "typeParameters"><title>Type Parameters</title> <para> --- 1276,1300 ---- (<literal>!</literal>). This is used to specify a non-&NULL; type when it is not known if the original type allowed &NULL; or not. This ! is only needed for type parameters; for all other types, ! <type>!<replaceable>type</replaceable></type> is ! equivalent to <type><replaceable>type</replaceable></type>. </para> <para> ! For instance, in the following function: </para> <para> ! <literal><![CDATA[<T> T myFunction(Collection<T>);]]></literal> ! </para> ! <para> ! the type parameter <type>T</type> can be instantiated at <emphasis>any</emphasis> type, including option types like <type>?String</type>. If it is necessary to exclude option types ! from the domain of <type>T</type>, the type can be specified this way: </para> <para> ! <literal><![CDATA[<!T> !T myFunction(Collection<!T>);]]></literal> </para> </section> + <section id = "typeParameters"><title>Type Parameters</title> <para> *************** *** 1224,1228 **** </para> <para> ! <type><type-variable[, type-variable...]></type> </para> <para> --- 1309,1315 ---- </para> <para> ! <type><<replaceable>type-variable</replaceable> ! <optional>, <replaceable>type-variable</replaceable> ... ! </optional>></type> </para> <para> *************** *** 1257,1269 **** <para> There is also a notation for the same class as the declaring class ! of a method: <literal>alike</literal>. ! For instance, the following class <literal>Foo</literal> declares a method <literal>copy</literal>, such that <literal>x.copy()</literal> has the same type as <literal>x</literal>, <literal>x</literal> ! being of any subclass of <literal>Foo</literal>. </para> <para> ! <example><title>A copy method with an exact type</title> <programlisting lang="nice"> class Foo --- 1344,1356 ---- <para> There is also a notation for the same class as the declaring class ! of a method: <type>alike</type>. ! For instance, the following class <type>Foo</type> declares a method <literal>copy</literal>, such that <literal>x.copy()</literal> has the same type as <literal>x</literal>, <literal>x</literal> ! being of any subclass of <type>Foo</type>. </para> <para> ! <example id="ex:copy"><title>A copy method with an exact type</title> <programlisting lang="nice"> class Foo *************** *** 1282,1286 **** copy(b#Bar) = new Bar(value: b.value, id: generateNewId()); ! }</programlisting> </example> </para> --- 1369,1373 ---- copy(b#Bar) = new Bar(value: b.value, id: generateNewId()); ! </programlisting> </example> </para> |
From: <bo...@us...> - 2003-04-23 10:37:14
|
Update of /cvsroot/nice/Nice/web In directory sc8-pr-cvs1:/tmp/cvs-serv30469/web Modified Files: manual.xml Log Message: Fixed the link to Doc.OptionTypes. Index: manual.xml =================================================================== RCS file: /cvsroot/nice/Nice/web/manual.xml,v retrieving revision 1.15 retrieving revision 1.16 diff -C2 -d -r1.15 -r1.16 *** manual.xml 23 Apr 2003 08:49:46 -0000 1.15 --- manual.xml 23 Apr 2003 10:36:43 -0000 1.16 *************** *** 1161,1169 **** if (arg != null) { //Here Nice knows arg is not null, so it can ! // be passed to a method which takes a String! ! foo(arg); } foo(arg); //Here arg may or may not be null, ! //so Nice gives a compile error. } </programlisting> --- 1161,1169 ---- if (arg != null) { //Here Nice knows arg is not null, so it can ! // be passed to a method which takes a String. ! foo(arg); } foo(arg); //Here arg may or may not be null, ! //so Nice gives a compilation error. } </programlisting> *************** *** 1189,1193 **** <para> For more details, see ! <ulink url="http://nice.sourceforge.net/cgi-bin/twiki/view/Doc/OptionType"> the Wiki page about option types</ulink>. </para> --- 1189,1193 ---- <para> For more details, see ! <ulink url="http://nice.sourceforge.net/cgi-bin/twiki/view/Doc/OptionTypes"> the Wiki page about option types</ulink>. </para> |
From: <bo...@us...> - 2003-04-23 09:22:01
|
Update of /cvsroot/nice/Nice/stdlib/nice/lang/inline In directory sc8-pr-cvs1:/tmp/cvs-serv25677/stdlib/nice/lang/inline Modified Files: Assert.java Log Message: Made constant fields final. Index: Assert.java =================================================================== RCS file: /cvsroot/nice/Nice/stdlib/nice/lang/inline/Assert.java,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** Assert.java 19 Mar 2003 00:45:17 -0000 1.3 --- Assert.java 23 Apr 2003 09:21:52 -0000 1.4 *************** *** 43,48 **** private boolean assertEnableCheck; ! private static Assert instance = new Assert(true); ! private static Assert contractInstance = new Assert(false); public void compile (ApplyExp exp, Compilation comp, Target target) --- 43,48 ---- private boolean assertEnableCheck; ! private static final Assert instance = new Assert(true); ! private static final Assert contractInstance = new Assert(false); public void compile (ApplyExp exp, Compilation comp, Target target) *************** *** 78,85 **** } ! private static ClassType errorClass = ClassType.make("nice.lang.AssertionFailed"); ! private static Method errorInit = errorClass.getDeclaredMethod("<init>", new Type[]{}), errorInitString = errorClass.getDeclaredMethod --- 78,85 ---- } ! private static final ClassType errorClass = ClassType.make("nice.lang.AssertionFailed"); ! private static final Method errorInit = errorClass.getDeclaredMethod("<init>", new Type[]{}), errorInitString = errorClass.getDeclaredMethod |
From: <bo...@us...> - 2003-04-23 08:50:11
|
Update of /cvsroot/nice/Nice/web In directory sc8-pr-cvs1:/tmp/cvs-serv11166/web Modified Files: manual.xml Log Message: Precisions about numeric primitive types conversions. Index: manual.xml =================================================================== RCS file: /cvsroot/nice/Nice/web/manual.xml,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -d -r1.14 -r1.15 *** manual.xml 18 Apr 2003 15:38:55 -0000 1.14 --- manual.xml 23 Apr 2003 08:49:46 -0000 1.15 *************** *** 861,867 **** </section> ! <section id="conversion"><title>Conversion between primitive types</title> <para> ! The primitive types are, from the largest to the smallest: <literal>double, float, long, int, short, byte</literal>, and <literal>char</literal> which is smaller than --- 861,867 ---- </section> ! <section id="conversion"><title>Conversion between numeric primitive types</title> <para> ! The numeric primitive types are, from the largest to the smallest: <literal>double, float, long, int, short, byte</literal>, and <literal>char</literal> which is smaller than *************** *** 873,877 **** <para> The explicit conversion is done by calling a special function, ! whose name is the target type. For instance, here is code to read characters from a <literal>Reader</literal>, whose <literal>read</literal> method returns an <literal>int</literal> --- 873,888 ---- <para> The explicit conversion is done by calling a special function, ! whose name is the target type. ! If <replaceable>e</replaceable> is a numeric expression, ! and <replaceable>type</replaceable> one of the numeric types, then ! <literal><replaceable>type</replaceable>(<replaceable>e</replaceable>)</literal> ! will convert the value of the expression, so that it is ! represented as a value in <replaceable>type</replaceable>. ! This is equivalent to the ! <literal>(<replaceable>type</replaceable>) e</literal> ! syntax in &java;. ! </para> ! <para> ! For instance, here is code to read characters from a <literal>Reader</literal>, whose <literal>read</literal> method returns an <literal>int</literal> |
From: <bo...@us...> - 2003-04-22 17:56:14
|
Update of /cvsroot/nice/Nice/src/bossa/syntax In directory sc8-pr-cvs1:/tmp/cvs-serv7938/src/bossa/syntax Modified Files: NiceClass.java ClassDefinition.java AST.java Log Message: Fix field access when a subclass appears before its superclass in the source. Index: NiceClass.java =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/syntax/NiceClass.java,v retrieving revision 1.43 retrieving revision 1.44 diff -C2 -d -r1.43 -r1.44 *** NiceClass.java 19 Apr 2003 13:35:50 -0000 1.43 --- NiceClass.java 22 Apr 2003 17:56:09 -0000 1.44 *************** *** 190,196 **** private void createFields() { - if (fields.length == 0) - return; - for (int i = 0; i < fields.length; i++) fields[i].createField(); --- 190,193 ---- *************** *** 441,450 **** // but before compilation. createFields(); - - // This needs to be done even if we don't recompile, - // since classes are always regenerated. - if (constructorMethod != null) - for (int i = 0; i < constructorMethod.length; i++) - constructorMethod[i].getCode(); } --- 438,441 ---- *************** *** 458,461 **** --- 449,466 ---- ((ToplevelFunction) child).compile(); } + + recompile(); + } + + /** + Called instead of compile is the package is up-to-date. + */ + public void recompile() + { + // This needs to be done even if we don't recompile, + // since classes are always regenerated. + if (constructorMethod != null) + for (int i = 0; i < constructorMethod.length; i++) + constructorMethod[i].getCode(); } Index: ClassDefinition.java =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/syntax/ClassDefinition.java,v retrieving revision 1.88 retrieving revision 1.89 diff -C2 -d -r1.88 -r1.89 *** ClassDefinition.java 18 Apr 2003 14:50:24 -0000 1.88 --- ClassDefinition.java 22 Apr 2003 17:56:09 -0000 1.89 *************** *** 580,583 **** --- 580,591 ---- } + /** + Called instead of compile is the package is up-to-date. + */ + void recompile() + { + implementation.recompile(); + } + /**************************************************************** * Initial Context *************** *** 661,664 **** --- 669,673 ---- void typecheck() {} void compile() {} + void recompile() {} abstract void printInterface(java.io.PrintWriter s); } Index: AST.java =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/syntax/AST.java,v retrieving revision 1.40 retrieving revision 1.41 diff -C2 -d -r1.40 -r1.41 *** AST.java 4 Mar 2003 16:50:19 -0000 1.40 --- AST.java 22 Apr 2003 17:56:10 -0000 1.41 *************** *** 147,154 **** { if (! generateCode) ! return; ! ! for(Iterator i = children.iterator();i.hasNext();) ! ((Definition)i.next()).compile(); } --- 147,159 ---- { if (! generateCode) ! { ! for (int i = 0; i < classes.length; i++) ! classes[i].recompile(); ! } ! else ! { ! for(Iterator i = children.iterator();i.hasNext();) ! ((Definition)i.next()).compile(); ! } } |
From: <bo...@us...> - 2003-04-22 17:56:13
|
Update of /cvsroot/nice/Nice/testsuite/compiler/classes/constructors In directory sc8-pr-cvs1:/tmp/cvs-serv7938/testsuite/compiler/classes/constructors Modified Files: compilation.testsuite Log Message: Fix field access when a subclass appears before its superclass in the source. Index: compilation.testsuite =================================================================== RCS file: /cvsroot/nice/Nice/testsuite/compiler/classes/constructors/compilation.testsuite,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** compilation.testsuite 19 Apr 2003 13:35:49 -0000 1.3 --- compilation.testsuite 22 Apr 2003 17:56:08 -0000 1.4 *************** *** 45,46 **** --- 45,53 ---- class B extends A {} equals(this@A, that@B) = true; + + /// PASS + /// Toplevel + // The subclass comes before the parent. + class B extends A { int b; } + + class A { int a; } |
From: <bo...@us...> - 2003-04-21 18:39:51
|
Update of /cvsroot/nice/Nice/bin In directory sc8-pr-cvs1:/tmp/cvs-serv22757/bin Modified Files: nicec Log Message: Removed the old 'nicer' script. A simple jvm is enough to run Nice programs. Cleaned up. The "java_g" command is platform dependant, and probably deprecated (it tracks back to turbocow@cma!). Index: nicec =================================================================== RCS file: /cvsroot/nice/Nice/bin/nicec,v retrieving revision 1.33 retrieving revision 1.34 diff -C2 -d -r1.33 -r1.34 *** nicec 19 Apr 2003 13:48:10 -0000 1.33 --- nicec 21 Apr 2003 18:39:46 -0000 1.34 *************** *** 3,41 **** ### The Nice compiler ### ! ### Copyright 2000 Daniel Bonniot ! ! JAVA=${JAVA-java} ! ! usage_nicer() ! { ! echo "usage: nicer path/to/file.jar" ! exit 1 ! } ! ! ## Parsing command line arguments ! ! read_java_arg() ! { ! if [ "x$1" = "x-g" ]; then ! JAVA="java_g -Djava.compiler=NONE" ! else ! JAVA="${JAVA} $1" ! fi ! } ! ! ## Testing if nice is properly installed ! test_installation() ! { ! if [ ! -r ${NICE} ]; then ! echo "Nice was not found in ${NICE}" ! echo "Please move the nice.jar file there" ! echo "or set the NICE environment variable to the location of the nice.jar file" ! exit 1 ! fi ! } ! ## Locating nice home find_home() --- 3,13 ---- ### The Nice compiler ### ! ### Copyright 2003 Daniel Bonniot ! ### The Java Virtual Machine can be specified in the JAVA environment variable. ! ### Arguments prefixed by -J will be passed to the JVM. ! ## Locating Nice home find_home() *************** *** 61,74 **** } ! ## Main part scriptName="$0" - progname=`basename $0` experimental=false while true; do case "x$1" in ! x-J*) read_java_arg "`expr substr "$1" 3 1000`";; ! x-e) experimental=true ;; *) break;; esac --- 33,48 ---- } ! ## Parsing special command line arguments + java=${JAVA-java} scriptName="$0" experimental=false while true; do case "x$1" in ! x-J*) ! java="${java} `expr substr \"$1\" 3 1000`";; ! x-e) ! experimental=true ;; *) break;; esac *************** *** 81,131 **** fi ! case $progname in ! nicec) ! # Having a trailing ":" at the end of CLASSPATH seems to act as ":." on some platforms. ! # We don't want that by default (if CLASSPATH is empty). ! if [ -z "${CLASSPATH}" ]; then ! CLASSPATH=${NICEC_JAR} ! else ! CLASSPATH=${NICEC_JAR}:${CLASSPATH} ! fi ! if [ $experimental = true ]; then ! CLASSPATH=${APPHOME}/classes:${APPHOME}/classes.old:${CLASSPATH} ! fi ! export CLASSPATH ! system_args="--runtime=${NICEC_JAR}" ! gcj="`which gcj 2>/dev/null`" ! # Check the string found is really a file ! # This is a work-around for a bug in OS X: ! # which gcj returns 0 (success) and prints "no gcj in $PATH" ! if [ -f "$gcj" ]; then ! system_args="${system_args} --native-compiler=${gcj}" ! fi ! exec ${JAVA} nice.tools.compiler.fun ${system_args} "$@" ! ;; ! nicer) ! jar=$1 ! if [ -z "$jar" ]; then ! usage_nicer ! elif [ ! -f "$jar" ]; then ! if [ -f "${jar}.jar" ]; then ! jar="${jar}.jar" ! else ! echo "$jar does not exist" ! usage_nicer ! fi ! fi ! shift ! CLASSPATH=$jar:${NICEC}:$CLASSPATH ! export CLASSPATH ! exec ${JAVA} nice.tools.runJar ${jar} "$@" ! ;; ! *) ! echo "unknow nice command: ${progname}" ! exit 1 ! ;; ! esac --- 55,81 ---- fi ! # Having a trailing ":" at the end of CLASSPATH seems to act as ":." on some platforms. ! # We don't want that by default (if CLASSPATH is empty). ! if [ -z "${CLASSPATH}" ]; then ! CLASSPATH=${NICEC_JAR} ! else ! CLASSPATH=${NICEC_JAR}:${CLASSPATH} ! fi ! if [ $experimental = true ]; then ! CLASSPATH=${APPHOME}/classes:${APPHOME}/classes.old:${CLASSPATH} ! fi ! export CLASSPATH ! system_args="--runtime=${NICEC_JAR}" ! gcj="`which gcj 2>/dev/null`" ! # Check the string found is really a file ! # This is a work-around for a bug in OS X: ! # which gcj returns 0 (success) and prints "no gcj in $PATH" ! if [ -f "$gcj" ]; then ! system_args="${system_args} --native-compiler=${gcj}" ! fi ! ! exec ${java} nice.tools.compiler.fun ${system_args} "$@" |
From: <bo...@us...> - 2003-04-21 18:37:51
|
Update of /cvsroot/nice/Nice In directory sc8-pr-cvs1:/tmp/cvs-serv20173 Modified Files: Makefile Log Message: Removed the old 'nicer' script. A simple jvm is enough to run Nice programs. Index: Makefile =================================================================== RCS file: /cvsroot/nice/Nice/Makefile,v retrieving revision 1.115 retrieving revision 1.116 diff -C2 -d -r1.115 -r1.116 *** Makefile 19 Apr 2003 13:44:46 -0000 1.115 --- Makefile 21 Apr 2003 18:37:48 -0000 1.116 *************** *** 124,128 **** bootstrap: parser cd src/gnu/lists && ./withCollections - ln -sf nicec bin/nicer mkdir -p classes cd classes; jar xf ../external/gj.jar java --- 124,127 ---- *************** *** 143,147 **** ${NICEC} -r bossa.syntax cd src;\ ! ${JAVAC} bossa/modules/Package.java nice/tools/runJar.java ../stdlib/nice/lang/rawArray.java gnu/bytecode/dump.java ant: --- 142,146 ---- ${NICEC} -r bossa.syntax cd src;\ ! ${JAVAC} bossa/modules/Package.java ../stdlib/nice/lang/rawArray.java gnu/bytecode/dump.java ant: |
From: <bo...@us...> - 2003-04-21 18:37:51
|
Update of /cvsroot/nice/Nice/src/nice/tools In directory sc8-pr-cvs1:/tmp/cvs-serv20173/src/nice/tools Removed Files: runJar.java Log Message: Removed the old 'nicer' script. A simple jvm is enough to run Nice programs. --- runJar.java DELETED --- |
From: <bo...@us...> - 2003-04-21 18:05:24
|
Update of /cvsroot/nice/Nice/distrib In directory sc8-pr-cvs1:/tmp/cvs-serv15887/distrib Modified Files: prepare-bootstrap Log Message: Removed debug info. Index: prepare-bootstrap =================================================================== RCS file: /cvsroot/nice/Nice/distrib/prepare-bootstrap,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** prepare-bootstrap 19 Apr 2003 15:04:01 -0000 1.1 --- prepare-bootstrap 21 Apr 2003 18:05:19 -0000 1.2 *************** *** 1,5 **** #! /bin/sh -x - echo $0 $1 $2 $3 - cp -i ../../../share/java/nice.jar external/nice-bootstrap.jar --- 1,3 ---- |
From: <bo...@us...> - 2003-04-19 15:12:10
|
Update of /cvsroot/nice/Nice/debian In directory sc8-pr-cvs1:/tmp/cvs-serv21412/debian Modified Files: control Log Message: No longer build-depends on itself. Depends on java1-runtime. Index: control =================================================================== RCS file: /cvsroot/nice/Nice/debian/control,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** control 19 Apr 2003 08:54:19 -0000 1.11 --- control 19 Apr 2003 15:12:02 -0000 1.12 *************** *** 3,12 **** Priority: optional Maintainer: Daniel Bonniot <bo...@us...> ! Build-Depends-Indep: debhelper (>> 3.0.0), java-compiler, nice, groff Standards-Version: 3.5.9 Package: nice Architecture: all ! Depends: java-virtual-machine Suggests: emacsen Description: Extension of Java with parametric types, multi-methods, and more --- 3,12 ---- Priority: optional Maintainer: Daniel Bonniot <bo...@us...> ! Build-Depends-Indep: debhelper (>> 3.0.0), java-compiler, groff Standards-Version: 3.5.9 Package: nice Architecture: all ! Depends: java-virtual-machine, java1-runtime Suggests: emacsen Description: Extension of Java with parametric types, multi-methods, and more |
From: <bo...@us...> - 2003-04-19 15:04:05
|
Update of /cvsroot/nice/Nice/distrib In directory sc8-pr-cvs1:/tmp/cvs-serv18773/distrib Modified Files: Makefile Added Files: prepare-bootstrap Log Message: Make the debian package from self-contained sources. --- NEW FILE: prepare-bootstrap --- #! /bin/sh -x echo $0 $1 $2 $3 cp -i ../../../share/java/nice.jar external/nice-bootstrap.jar Index: Makefile =================================================================== RCS file: /cvsroot/nice/Nice/distrib/Makefile,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** Makefile 28 Jan 2003 18:49:05 -0000 1.3 --- Makefile 19 Apr 2003 15:04:01 -0000 1.4 *************** *** 17,21 **** deb $(CVSBUILDDIR)/$(DEB): @echo Creating Debian package version ${VERSION} ! cd .. && env CVSROOT=:pserver:ano...@cv...:/cvsroot/nice cvs-buildpackage -MNice -W${CVSBUILDDIR} -us -uc -rfakeroot -F --- 17,21 ---- deb $(CVSBUILDDIR)/$(DEB): @echo Creating Debian package version ${VERSION} ! cd .. && env CVSROOT=:pserver:ano...@cv...:/cvsroot/nice cvs-buildpackage -MNice -W${CVSBUILDDIR} -H${PWD}/prepare-bootstrap -us -uc -rfakeroot -F |