nice-commit Mailing List for The Nice Programming Language (Page 114)
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: <xo...@us...> - 2003-04-29 01:05:16
|
Update of /cvsroot/nice/Nice In directory sc8-pr-cvs1:/tmp/cvs-serv17198 Modified Files: prj.el Log Message: Substatements should be indented, oops. Index: prj.el =================================================================== RCS file: /cvsroot/nice/Nice/prj.el,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** prj.el 29 Apr 2003 00:17:58 -0000 1.2 --- prj.el 29 Apr 2003 01:05:12 -0000 1.3 *************** *** 9,11 **** (setq tab-width 8) (setq c-basic-offset 2) ! (c-set-offset 'substatement-open 0) --- 9,11 ---- (setq tab-width 8) (setq c-basic-offset 2) ! |
|
From: <bo...@us...> - 2003-04-29 01:02:38
|
Update of /cvsroot/nice/Nice/src/bossa/syntax
In directory sc8-pr-cvs1:/tmp/cvs-serv15811/src/bossa/syntax
Modified Files:
typecheck.nice tools.nice analyse.nice Block.java
Log Message:
Implemented 'var name = value'. It takes the type of value as the type for
name (provided it is not polymorphic).
Index: typecheck.nice
===================================================================
RCS file: /cvsroot/nice/Nice/src/bossa/syntax/typecheck.nice,v
retrieving revision 1.59
retrieving revision 1.60
diff -C2 -d -r1.59 -r1.60
*** typecheck.nice 28 Apr 2003 15:49:23 -0000 1.59
--- typecheck.nice 29 Apr 2003 01:01:59 -0000 1.60
***************
*** 547,559 ****
MonoSymbol target = notNull(decl.left());
! try{
! decl.value = checkAssignment(notNull(target.getType()), value);
! }
! catch(TypingEx t){
! if (notNullError(t, target, value.toString()))
! throw assignmentError(target, target.name.toString(),
! String.valueOf(target.getMonotype),
! value);
! }
}
--- 547,568 ----
MonoSymbol target = notNull(decl.left());
! ?mlsub.typing.Monotype type = target.getMonotype();
! if (type == null)
! {
! value.typecheck();
! target.type = checkMonomorphic(value.getType(), decl);
! }
! else
! {
! try{
! decl.value = checkAssignment(new mlsub.typing.Polytype(type), value);
! }
! catch(TypingEx t){
! if (notNullError(t, target, value.toString()))
! throw assignmentError(target, target.name.toString(),
! String.valueOf(target.getMonotype),
! value);
! }
! }
}
***************
*** 564,580 ****
notNull(decl.left).type = type;
! // Check that the type is not polymorphic, as this could be unsafe.
! if (type.isMonomorphic())
! return;
!
! type.simplify();
! if (type.isMonomorphic())
! return;
!
! throw new bossa.util.UserError
! (decl,
! "The value has a polymorphic type: " + type +
! "\nOmitting the type here is not supported by Nice yet." +
! "\nPlease declare the monomorphic type of " + decl.getName());
}
--- 573,577 ----
notNull(decl.left).type = type;
! checkMonomorphic(type, decl);
}
Index: tools.nice
===================================================================
RCS file: /cvsroot/nice/Nice/src/bossa/syntax/tools.nice,v
retrieving revision 1.19
retrieving revision 1.20
diff -C2 -d -r1.19 -r1.20
*** tools.nice 12 Mar 2003 03:26:37 -0000 1.19
--- tools.nice 29 Apr 2003 01:02:01 -0000 1.20
***************
*** 55,58 ****
--- 55,76 ----
notNull(bossa.syntax.Monotype.maybe(nice.tools.code.Types.rawType(m)));
+ mlsub.typing.Monotype checkMonomorphic(mlsub.typing.Polytype type,
+ Block.LocalValue decl)
+ {
+ if (! type.isMonomorphic())
+ {
+ type.simplify();
+
+ if (! type.isMonomorphic())
+ throw new bossa.util.UserError
+ (decl,
+ "The value has a polymorphic type: " + type +
+ "\nOmitting the type here is not supported by Nice yet." +
+ "\nPlease declare the monomorphic type of " + decl.getName());
+ }
+
+ return type.getMonotype();
+ }
+
/*
Make sure that the error is attached to a location.
Index: analyse.nice
===================================================================
RCS file: /cvsroot/nice/Nice/src/bossa/syntax/analyse.nice,v
retrieving revision 1.60
retrieving revision 1.61
diff -C2 -d -r1.60 -r1.61
*** analyse.nice 28 Apr 2003 15:49:27 -0000 1.60
--- analyse.nice 29 Apr 2003 01:02:01 -0000 1.61
***************
*** 174,180 ****
void addVar(MonoSymbol symbol)
{
! symbol.type = notNull(notNull(symbol.syntacticType).resolve(this.typeMap));
! if (nice.tools.code.Types.isVoid(symbol.type))
! throw error(symbol, "A variable cannot have a void type");
this.vars[symbol.name.toString()] = symbol;
--- 174,184 ----
void addVar(MonoSymbol symbol)
{
! ?Monotype type = symbol.syntacticType;
! if (type != null)
! {
! 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");
! }
this.vars[symbol.name.toString()] = symbol;
Index: Block.java
===================================================================
RCS file: /cvsroot/nice/Nice/src/bossa/syntax/Block.java,v
retrieving revision 1.54
retrieving revision 1.55
diff -C2 -d -r1.54 -r1.55
*** Block.java 23 Mar 2003 23:03:02 -0000 1.54
--- Block.java 29 Apr 2003 01:02:02 -0000 1.55
***************
*** 96,99 ****
--- 96,101 ----
work as expected.
*/
+ public abstract void addNext(LocatedString name, Expression value);
+
LocalValue next, last;
}
|
|
From: <bo...@us...> - 2003-04-29 01:02:09
|
Update of /cvsroot/nice/Nice/src/bossa/parser
In directory sc8-pr-cvs1:/tmp/cvs-serv15811/src/bossa/parser
Modified Files:
Parser.jj
Log Message:
Implemented 'var name = value'. It takes the type of value as the type for
name (provided it is not polymorphic).
Index: Parser.jj
===================================================================
RCS file: /cvsroot/nice/Nice/src/bossa/parser/Parser.jj,v
retrieving revision 1.159
retrieving revision 1.160
diff -C2 -d -r1.159 -r1.160
*** Parser.jj 28 Apr 2003 23:28:46 -0000 1.159
--- Parser.jj 29 Apr 2003 01:02:03 -0000 1.160
***************
*** 986,990 ****
if (t!=null)
User.warning(new Location(t),
! "'const' is deprecated use 'final' instead.");
}
]
--- 986,990 ----
if (t!=null)
User.warning(new Location(t),
! "'const' is deprecated. Use 'final' instead.");
}
]
***************
*** 2375,2379 ****
(t="final" | t="const")
{User.warning(new Location(t),
! "'"+t.toString()+"' is deprecated use 'let' instead.");
}
| "let"
--- 2375,2379 ----
(t="final" | t="const")
{User.warning(new Location(t),
! "'"+t.toString()+"' is deprecated. Use 'let' instead.");
}
| "let"
***************
*** 2397,2401 ****
(t="final" | t="const")
{User.warning(new Location(t),
! "'"+t.toString()+"' is deprecated use 'let' instead.");
}
| "let"
--- 2397,2401 ----
(t="final" | t="const")
{User.warning(new Location(t),
! "'"+t.toString()+"' is deprecated. Use 'let' instead.");
}
| "let"
***************
*** 2404,2410 ****
id=ident()
[ "=" e=Expression() ]
! { Block.LocalConstant res;
if (constant) {res = new Block.LocalConstant(id,e);}
! else {throw new UserError(new Location(t), "'var' without type not implemented yet");}
}
( "," id=ident() "=" e=Expression() { res.addNext(id,e); } )*
--- 2404,2412 ----
id=ident()
[ "=" e=Expression() ]
! { Block.LocalValue res;
if (constant) {res = new Block.LocalConstant(id,e);}
! else if (e != null)
! res = new Block.LocalVariable(id, null, constant, e);
! else {throw new UserError(new Location(t), "'var' without type nor value is not implemented (yet)");}
}
( "," id=ident() "=" e=Expression() { res.addNext(id,e); } )*
|
|
From: <xo...@us...> - 2003-04-29 00:18:01
|
Update of /cvsroot/nice/Nice
In directory sc8-pr-cvs1:/tmp/cvs-serv32479
Modified Files:
prj.el
Log Message:
Changed JDE project file to maintain indenting conventions (8 space tabs, 2 space basic indents)
Index: prj.el
===================================================================
RCS file: /cvsroot/nice/Nice/prj.el,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** prj.el 2 Apr 2003 22:25:25 -0000 1.1
--- prj.el 29 Apr 2003 00:17:58 -0000 1.2
***************
*** 4,5 ****
--- 4,11 ----
'(jde-compile-option-directory "./classes")
'(jde-compile-option-sourcepath (quote ("./src" "./stdlib"))))
+
+ ;; Standard indentation settings for Java files in Nicec.
+ (setq indent-tabs-mode nil)
+ (setq tab-width 8)
+ (setq c-basic-offset 2)
+ (c-set-offset 'substatement-open 0)
|
|
From: <bo...@us...> - 2003-04-28 23:56:03
|
Update of /cvsroot/nice/Nice/lib/emacs
In directory sc8-pr-cvs1:/tmp/cvs-serv26169/lib/emacs
Modified Files:
nice-mode.el
Log Message:
Added the new 'let' keyword.
Index: nice-mode.el
===================================================================
RCS file: /cvsroot/nice/Nice/lib/emacs/nice-mode.el,v
retrieving revision 1.29
retrieving revision 1.30
diff -C2 -d -r1.29 -r1.30
*** nice-mode.el 12 Nov 2002 15:47:48 -0000 1.29
--- nice-mode.el 28 Apr 2003 23:56:00 -0000 1.30
***************
*** 196,200 ****
;; Keywords
! '("\\<\\(fun\\|static\\|final\\|transient\\|volatile\\|const\\|extends\\|implements\\|abstract\\|public\\|private\\|var\\|class\\|interface\\|new\\|else\\|native\\|inline\\|import\\|package\\|alike\\|Any\\|return\\|break\\|continue\\|super\\|try\\|catch\\|finally\\|throw\\|instanceof\\|requires\\|ensures\\|assert\\|do\\)\\>\\|@\\|=>"
0 nice-keyword-face)
--- 196,200 ----
;; Keywords
! '("\\<\\(fun\\|static\\|final\\|transient\\|volatile\\|const\\|let\\|extends\\|implements\\|abstract\\|public\\|private\\|var\\|class\\|interface\\|new\\|else\\|native\\|inline\\|import\\|package\\|alike\\|Any\\|return\\|break\\|continue\\|super\\|try\\|catch\\|finally\\|throw\\|instanceof\\|requires\\|ensures\\|assert\\|do\\)\\>\\|@\\|=>"
0 nice-keyword-face)
|
|
From: <ar...@us...> - 2003-04-28 23:28:50
|
Update of /cvsroot/nice/Nice/stdlib/nice/getopt In directory sc8-pr-cvs1:/tmp/cvs-serv17425/F:/nice/stdlib/nice/getopt Modified Files: gnugetopt.nice Log Message: Changed to syntax of localdeclaration to: Type() Name() [ "=" expression() ] ";" ( "var" | "let") [ Type() ] Name() [ "=" expression() ] ";" Give warnings when using "final" or "const" also warning by "const" "var" without a typing doesn't work yet because it isn't implemented "let" without a default value is broken see the testcases. Index: gnugetopt.nice =================================================================== RCS file: /cvsroot/nice/Nice/stdlib/nice/getopt/gnugetopt.nice,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** gnugetopt.nice 31 Mar 2003 19:15:13 -0000 1.1 --- gnugetopt.nice 28 Apr 2003 23:28:47 -0000 1.2 *************** *** 42,46 **** private int first_nonopt = 1; private int last_nonopt = 1; ! private const int ordering = 2;//== PERMUTE private String progname; --- 42,46 ---- private int first_nonopt = 1; private int last_nonopt = 1; ! private final int ordering = 2;//== PERMUTE private String progname; |
|
From: <ar...@us...> - 2003-04-28 23:28:50
|
Update of /cvsroot/nice/Nice/testsuite/compiler/syntax
In directory sc8-pr-cvs1:/tmp/cvs-serv17425/F:/nice/testsuite/compiler/syntax
Modified Files:
expressions.testsuite
Added Files:
localvariable.testsuite
Log Message:
Changed to syntax of localdeclaration to:
Type() Name() [ "=" expression() ] ";"
( "var" | "let") [ Type() ] Name() [ "=" expression() ] ";"
Give warnings when using "final" or "const" also warning by "const"
"var" without a typing doesn't work yet because it isn't implemented
"let" without a default value is broken see the testcases.
--- NEW FILE: localvariable.testsuite ---
/// PASS bug
let int i;
i = 0;
/// PASS
let int i = 0;
/// PASS
var int i;
i = 0;
/// PASS
var int i = 0;
/// FAIL
let int i;
i = 0;
i = 1;
/// FAIL
let int i = 0;
i = 1;
/// PASS
var int i;
i = 0;
i = 1;
/// PASS
var int i = 0;
i = 1;
/// PASS bug
let i;
i = 0;
/// PASS
let i = 0;
/// PASS bug
/// COMMENT: not implemented yet
var i;
i = 0;
/// PASS bug
/// COMMENT: not implemented yet
var i = 0;
/// FAIL bug
let i;
i = 0;
i = 1;
/// FAIL
let i = 0;
i = 1;
/// PASS bug
/// COMMENT: not implemented yet
var i;
i = 0;
i = 1;
/// PASS bug
/// COMMENT: not implemented yet
var i = 0;
i = 1;
Index: expressions.testsuite
===================================================================
RCS file: /cvsroot/nice/Nice/testsuite/compiler/syntax/expressions.testsuite,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** expressions.testsuite 20 Feb 2003 00:02:19 -0000 1.2
--- expressions.testsuite 28 Apr 2003 23:28:46 -0000 1.3
***************
*** 21,28 ****
/// TOPLEVEL
String->String->void f4(String x) = fun(String y)=> fun(String z)=> {};
-
- /// FAIL
- final int i;
-
- /// PASS
- final int i = 0;
--- 21,22 ----
|
|
From: <ar...@us...> - 2003-04-28 23:28:49
|
Update of /cvsroot/nice/Nice/src/bossa/parser
In directory sc8-pr-cvs1:/tmp/cvs-serv17425/F:/nice/src/bossa/parser
Modified Files:
Parser.jj
Log Message:
Changed to syntax of localdeclaration to:
Type() Name() [ "=" expression() ] ";"
( "var" | "let") [ Type() ] Name() [ "=" expression() ] ";"
Give warnings when using "final" or "const" also warning by "const"
"var" without a typing doesn't work yet because it isn't implemented
"let" without a default value is broken see the testcases.
Index: Parser.jj
===================================================================
RCS file: /cvsroot/nice/Nice/src/bossa/parser/Parser.jj,v
retrieving revision 1.158
retrieving revision 1.159
diff -C2 -d -r1.158 -r1.159
*** Parser.jj 28 Apr 2003 20:57:53 -0000 1.158
--- Parser.jj 28 Apr 2003 23:28:46 -0000 1.159
***************
*** 191,194 ****
--- 191,195 ----
| < RETURN: "return" >
| < VARIABLE: "var" > /* Nice specific */
+ | < LET: "let" > /* Nice specific */
// modifiers
***************
*** 974,977 ****
--- 975,979 ----
boolean isFinal=false, isTransient = false, isVolatile = false;
Expression value = null;
+ Token t = null;
}
{
***************
*** 980,984 ****
| "private-write"
| ( ("public" | "private" | {} )
! [ ( "final" | "const" ) { isFinal=true; } ]
)
)
--- 982,992 ----
| "private-write"
| ( ("public" | "private" | {} )
! [ ( "final" | t="const" )
! { isFinal=true;
! if (t!=null)
! User.warning(new Location(t),
! "'const' is deprecated use 'final' instead.");
! }
! ]
)
)
***************
*** 2330,2340 ****
{
(
! LOOKAHEAD( "final" | "const" | monotype() <IDENT>)
! (
! LOOKAHEAD( ( "final" | "const" ) <IDENT> "=" )
! res = LocalConstant()
! |
res = LocalDeclaration()
- )
|
// There are two cases for tuples (declaring a variable or not).
--- 2338,2343 ----
{
(
! LOOKAHEAD( "final" | "const" | "var" | "let" | monotype() <IDENT>)
res = LocalDeclaration()
|
// There are two cases for tuples (declaring a variable or not).
***************
*** 2359,2402 ****
Statement LocalDeclaration() :
{
! Monotype t = null;
LocatedString id;
FormalParameters parameters;
Statement body;
Expression e=null;
! boolean constant = false;
}
{
! [ ( "final" | "const" ) { constant = true; } ]
! t = monotype()
! id=ident()
! (
! "(" parameters = formalParameters(false) ")" body = code()
! { return Block.LocalFunction.make(id, t, parameters, body); }
! |
! [ "=" e=Expression() ]
! { Block.LocalVariable res = new Block.LocalVariable(id,t,constant,e); }
! ( "," id=ident() {e=null;} [ "=" e=Expression() ] { res.addNext(id,e); } )*
";"
{ return res; }
)
- }
-
- Statement LocalConstant() :
- {
- LocatedString id;
- FormalParameters parameters;
- Statement body;
- Expression e=null;
- boolean constant = false;
- }
- {
- ( "final" | "const" )
- id=ident()
- "="
- e=Expression()
- { Block.LocalConstant res = new Block.LocalConstant(id,e); }
- ( "," id=ident() "=" e=Expression() { res.addNext(id,e); } )*
- ";"
- { return res; }
}
--- 2362,2415 ----
Statement LocalDeclaration() :
{
! Monotype type = null;
LocatedString id;
FormalParameters parameters;
Statement body;
Expression e=null;
! boolean constant = true;
! Token t = null;
}
{
! ( LOOKAHEAD( [ ("final"|"const"|"let"|"var") ] monotype() ident() )
! (
! (t="final" | t="const")
! {User.warning(new Location(t),
! "'"+t.toString()+"' is deprecated use 'let' instead.");
! }
! | "let"
! | "var" {constant = false;}
! | {constant = false;}
! )
! type = monotype()
! id=ident()
! (
! "(" parameters=formalParameters(false) ")" body=code()
! { return Block.LocalFunction.make(id, type, parameters, body); }
! |
! [ "=" e=Expression() ]
! { Block.LocalVariable res = new Block.LocalVariable(id,type,constant,e); }
! ( "," id=ident() {e=null;} [ "=" e=Expression() ] { res.addNext(id,e); } )*
! ";"
! { return res; }
! )
! |
! (
! (t="final" | t="const")
! {User.warning(new Location(t),
! "'"+t.toString()+"' is deprecated use 'let' instead.");
! }
! | "let"
! | t="var" {constant = false;}
! )
! id=ident()
! [ "=" e=Expression() ]
! { Block.LocalConstant res;
! if (constant) {res = new Block.LocalConstant(id,e);}
! else {throw new UserError(new Location(t), "'var' without type not implemented yet");}
! }
! ( "," id=ident() "=" e=Expression() { res.addNext(id,e); } )*
";"
{ return res; }
)
}
|
|
From: <bo...@us...> - 2003-04-28 21:54:15
|
Update of /cvsroot/nice/Nice/web
In directory sc8-pr-cvs1:/tmp/cvs-serv4897/web
Modified Files:
manual.xml
Log Message:
Updated the manual with the new syntax for type parameters in method
implementations.
Index: manual.xml
===================================================================
RCS file: /cvsroot/nice/Nice/web/manual.xml,v
retrieving revision 1.18
retrieving revision 1.19
diff -C2 -d -r1.18 -r1.19
*** manual.xml 26 Apr 2003 10:18:29 -0000 1.18
--- manual.xml 28 Apr 2003 21:53:59 -0000 1.19
***************
*** 534,539 ****
<para>
<literal>
- <replaceable>method-name</replaceable>
<<replaceable>type-parameters</replaceable>>
(<optional><replaceable>arguments</replaceable></optional>)
&LBRACE; body &RBRACE;
--- 534,539 ----
<para>
<literal>
<<replaceable>type-parameters</replaceable>>
+ <replaceable>method-name</replaceable>
(<optional><replaceable>arguments</replaceable></optional>)
&LBRACE; body &RBRACE;
***************
*** 548,552 ****
! /* This version won't compile because the T type isn't in scope:
lastItem(coll)
--- 548,552 ----
! /* This version is incorrect because the type parameter T is not in scope:
lastItem(coll)
***************
*** 557,571 ****
*/
- /* This one won't compile because Iterator needs a type argument:
-
- lastItem(coll)
- {
- Iterator it = coll.iterator();
- //...
- }
- */
-
// This one will work correctly:
! lastItem<T>(coll)
{
Iterator<T> = coll.iterator();
--- 557,562 ----
*/
// This one will work correctly:
! <T> lastItem(coll)
{
Iterator<T> = coll.iterator();
|
|
From: <bo...@us...> - 2003-04-28 20:58:28
|
Update of /cvsroot/nice/Nice/src/bossa/parser
In directory sc8-pr-cvs1:/tmp/cvs-serv4114/src/bossa/parser
Modified Files:
Parser.jj
Log Message:
In a method implementation, binding the type parameters should now
be done in front.
Index: Parser.jj
===================================================================
RCS file: /cvsroot/nice/Nice/src/bossa/parser/Parser.jj,v
retrieving revision 1.157
retrieving revision 1.158
diff -C2 -d -r1.157 -r1.158
*** Parser.jj 28 Apr 2003 18:10:32 -0000 1.157
--- Parser.jj 28 Apr 2003 20:57:53 -0000 1.158
***************
*** 1237,1241 ****
{}
{
! [ "<" typeConstructors() ">" ] identOrBackquoted() [ "<" strings() ">" ] "("
}
--- 1237,1241 ----
{}
{
! [ "<" strings() ">" ] identOrBackquoted() [ "<" strings() ">" ] "("
}
***************
*** 1273,1278 ****
}
{
- name=identOrBackquoted()
[ "<" binders=strings() ">" ]
"("
--- 1273,1288 ----
}
{
[ "<" binders=strings() ">" ]
+
+ name=identOrBackquoted()
+
+ // Deprecated.
+ [ { Token t; }
+ t="<" binders=strings() ">"
+ { User.warning(new Location(t),
+ "This syntax is deprecated.\n" +
+ "Type parameters should now be placed in front of the method implementation.");
+ }
+ ]
"("
|
|
From: <bo...@us...> - 2003-04-28 20:58:27
|
Update of /cvsroot/nice/Nice/testsuite/compiler/methods
In directory sc8-pr-cvs1:/tmp/cvs-serv4114/testsuite/compiler/methods
Modified Files:
parameterTypeNaming.testsuite
Log Message:
In a method implementation, binding the type parameters should now
be done in front.
Index: parameterTypeNaming.testsuite
===================================================================
RCS file: /cvsroot/nice/Nice/testsuite/compiler/methods/parameterTypeNaming.testsuite,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** parameterTypeNaming.testsuite 28 Apr 2003 18:10:27 -0000 1.2
--- parameterTypeNaming.testsuite 28 Apr 2003 20:57:52 -0000 1.3
***************
*** 3,7 ****
<Collection C, T, U> C<U> bar(C<T>, T->U);
bar(x, f) { throw new Error(); }
! bar<C,T,U>(l@List : L, f)
{
L<U> res = similarEmptyCollection(l);
--- 3,7 ----
<Collection C, T, U> C<U> bar(C<T>, T->U);
bar(x, f) { throw new Error(); }
! <C,T,U> bar(l@List : L, f)
{
L<U> res = similarEmptyCollection(l);
***************
*** 26,30 ****
foo(a) = a;
! foo<T>(b@B : X) {
X copy = b.foo();
String useB = copy.b;
--- 26,30 ----
foo(a) = a;
! <T> foo(b@B : X) {
X copy = b.foo();
String useB = copy.b;
***************
*** 35,37 ****
/// Toplevel
// : can only come after a real dispatch, otherwise it is useless.
! foo<T>(a : X) {}
--- 35,37 ----
/// Toplevel
// : can only come after a real dispatch, otherwise it is useless.
! <T> foo(a : X) {}
|
|
From: <bo...@us...> - 2003-04-28 20:58:27
|
Update of /cvsroot/nice/Nice/testsuite/lib/java/util
In directory sc8-pr-cvs1:/tmp/cvs-serv4114/testsuite/lib/java/util
Modified Files:
collections.testsuite
Log Message:
In a method implementation, binding the type parameters should now
be done in front.
Index: collections.testsuite
===================================================================
RCS file: /cvsroot/nice/Nice/testsuite/lib/java/util/collections.testsuite,v
retrieving revision 1.9
retrieving revision 1.10
diff -C2 -d -r1.9 -r1.10
*** collections.testsuite 23 Apr 2003 21:46:06 -0000 1.9
--- collections.testsuite 28 Apr 2003 20:57:51 -0000 1.10
***************
*** 60,64 ****
<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()) {
--- 60,64 ----
<T,U,V | U <: T, V <: T> Set<T> intersection(Set<U>, Set<V>);
! <T,U,V> intersection(s1@Set, s2@Set) {
Set<T> res = new HashSet();
if (s1.size() < s2.size()) {
|
|
From: <bo...@us...> - 2003-04-28 20:57:59
|
Update of /cvsroot/nice/Nice/debian
In directory sc8-pr-cvs1:/tmp/cvs-serv4114/debian
Modified Files:
changelog
Log Message:
In a method implementation, binding the type parameters should now
be done in front.
Index: changelog
===================================================================
RCS file: /cvsroot/nice/Nice/debian/changelog,v
retrieving revision 1.151
retrieving revision 1.152
diff -C2 -d -r1.151 -r1.152
*** changelog 25 Apr 2003 01:09:38 -0000 1.151
--- changelog 28 Apr 2003 20:57:55 -0000 1.152
***************
*** 9,12 ****
--- 9,33 ----
* Compilation does not fail anymore if some classes on the classpath
have an invalid bytecode format.
+ * In a method implementation, binding the type parameters should now
+ be done in front:
+ <T> T foo(T);
+ <T> foo(x@String) { T res = x; ... }
+ It is also possible to bind the runtime class of a parameter, by adding
+ ": name" at the end of the pattern. This is needed in some cases:
+ <Collection C, T, U> C<U> bar(C<T>, T->U);
+ bar(x, f) { ... }
+ <C,T,U> bar(l@List : L, f) // L is the runtime class of l.
+ {
+ L<U> res = similarEmptyCollection(l);
+ res.add(f(l[0]));
+
+ // Now we use the fact the res is a list.
+ // Therefore, it would be impossible to declare its type as C<U>.
+ res.add(res[0]);
+
+ // By returning res, we need the fact that it is a subtype of C<U>,
+ // so we could not declare its type as List<U>.
+ return res;
+ }
* Bugfix (overloaded symbols used inside && or || expressions).
|
|
From: <bo...@us...> - 2003-04-28 18:29:00
|
Update of /cvsroot/nice/Nice/src/bossa/syntax
In directory sc8-pr-cvs1:/tmp/cvs-serv32665/src/bossa/syntax
Modified Files:
MethodBodyDefinition.java
Log Message:
Simple simplification.
Index: MethodBodyDefinition.java
===================================================================
RCS file: /cvsroot/nice/Nice/src/bossa/syntax/MethodBodyDefinition.java,v
retrieving revision 1.119
retrieving revision 1.120
diff -C2 -d -r1.119 -r1.120
*** MethodBodyDefinition.java 28 Apr 2003 18:10:30 -0000 1.119
--- MethodBodyDefinition.java 28 Apr 2003 18:28:54 -0000 1.120
***************
*** 120,132 ****
type = new MonotypeVar("anonymous argument " + tn);
else
! // XXX optimize using this:
! // type = new MonotypeVar("type(" + p.name + ")<" + types[tn]);
! {
! LocatedString typeName;
! typeName = p.name.cloneLS();
! typeName.prepend("type(");
! typeName.append(")<" + types[tn]);
! type = new MonotypeVar(typeName.toString());
! }
}
--- 120,124 ----
type = new MonotypeVar("anonymous argument " + tn);
else
! type = new MonotypeVar("type(" + p.name + ")<" + types[tn]);
}
|
|
From: <bo...@us...> - 2003-04-28 18:11:02
|
Update of /cvsroot/nice/Nice/testsuite/compiler/methods
In directory sc8-pr-cvs1:/tmp/cvs-serv24896/testsuite/compiler/methods
Modified Files:
parameterTypeNaming.testsuite
Log Message:
Parameter type naming is now done on the tag only, as this is the only
interesting part.
Therefore, the part after : is always a type constructor variable, so we
don't need to declare anything before; it is declared there. So we remove
the syntax to declare additional type parameters in front of the method
implementation.
Index: parameterTypeNaming.testsuite
===================================================================
RCS file: /cvsroot/nice/Nice/testsuite/compiler/methods/parameterTypeNaming.testsuite,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** parameterTypeNaming.testsuite 25 Apr 2003 17:21:23 -0000 1.1
--- parameterTypeNaming.testsuite 28 Apr 2003 18:10:27 -0000 1.2
***************
*** 1,2 ****
--- 1,20 ----
+ /// PASS
+ /// Toplevel
+ <Collection C, T, U> C<U> bar(C<T>, T->U);
+ bar(x, f) { throw new Error(); }
+ bar<C,T,U>(l@List : L, f)
+ {
+ L<U> res = similarEmptyCollection(l);
+ res.add(f(l[0]));
+
+ // Now we use the fact the res is a list.
+ // Therefore, it would be impossible to declare its type as C<U>.
+ res.add(res[0]);
+
+ // By returning res, we need the fact that it is a subtype of C<U>,
+ // so we could not declare its type as List<U>.
+ return res;
+ }
+
/// Global
class A {}
***************
*** 8,12 ****
foo(a) = a;
! <X> foo<T>(b@B : X) {
X copy = b.foo();
String useB = copy.b;
--- 26,30 ----
foo(a) = a;
! foo<T>(b@B : X) {
X copy = b.foo();
String useB = copy.b;
***************
*** 17,19 ****
/// Toplevel
// : can only come after a real dispatch, otherwise it is useless.
! <X> foo<T>(a : X) {}
--- 35,37 ----
/// Toplevel
// : can only come after a real dispatch, otherwise it is useless.
! foo<T>(a : X) {}
|
|
From: <bo...@us...> - 2003-04-28 18:10:36
|
Update of /cvsroot/nice/Nice/src/bossa/parser
In directory sc8-pr-cvs1:/tmp/cvs-serv24896/src/bossa/parser
Modified Files:
Parser.jj
Log Message:
Parameter type naming is now done on the tag only, as this is the only
interesting part.
Therefore, the part after : is always a type constructor variable, so we
don't need to declare anything before; it is declared there. So we remove
the syntax to declare additional type parameters in front of the method
implementation.
Index: Parser.jj
===================================================================
RCS file: /cvsroot/nice/Nice/src/bossa/parser/Parser.jj,v
retrieving revision 1.156
retrieving revision 1.157
diff -C2 -d -r1.156 -r1.157
*** Parser.jj 25 Apr 2003 17:21:36 -0000 1.156
--- Parser.jj 28 Apr 2003 18:10:32 -0000 1.157
***************
*** 1187,1191 ****
Token t;
TypeIdent tc=null, additional = null;
! Monotype type=null;
Expression val = null;
boolean exactlyAt = false;
--- 1187,1191 ----
Token t;
TypeIdent tc=null, additional = null;
! TypeConstructor runtimeTC = null;
Expression val = null;
boolean exactlyAt = false;
***************
*** 1219,1223 ****
|
tc=typeIdent()
! [ ":" type=monotype() ]
)
|
--- 1219,1223 ----
|
tc=typeIdent()
! [ ":" runtimeTC = typeConstructor() ]
)
|
***************
*** 1230,1234 ****
[ "(" additional=typeIdent() ")" ]
{
! return new Pattern(name, tc, val, exactlyAt, additional, type, loc);
}
}
--- 1230,1234 ----
[ "(" additional=typeIdent() ")" ]
{
! return new Pattern(name, tc, val, exactlyAt, additional, runtimeTC, loc);
}
}
***************
*** 1268,1272 ****
Pattern p;
Collection binders=null;
- List newTypeVars=null;
LinkedList parameters=new LinkedList();
Statement body;
--- 1268,1271 ----
***************
*** 1274,1280 ****
}
{
- // introducing new Type variables
- [ "<" newTypeVars=typeConstructors() ">" ]
-
name=identOrBackquoted()
[ "<" binders=strings() ">" ]
--- 1273,1276 ----
***************
*** 1288,1292 ****
body = code()
{ return new MethodBodyDefinition(container,name,binders,
- newTypeVars,
parameters,body); }
}
--- 1284,1287 ----
|
|
From: <bo...@us...> - 2003-04-28 18:10:35
|
Update of /cvsroot/nice/Nice/src/bossa/syntax
In directory sc8-pr-cvs1:/tmp/cvs-serv24896/src/bossa/syntax
Modified Files:
Pattern.java MethodBodyDefinition.java
Log Message:
Parameter type naming is now done on the tag only, as this is the only
interesting part.
Therefore, the part after : is always a type constructor variable, so we
don't need to declare anything before; it is declared there. So we remove
the syntax to declare additional type parameters in front of the method
implementation.
Index: Pattern.java
===================================================================
RCS file: /cvsroot/nice/Nice/src/bossa/syntax/Pattern.java,v
retrieving revision 1.45
retrieving revision 1.46
diff -C2 -d -r1.45 -r1.46
*** Pattern.java 16 Apr 2003 18:38:58 -0000 1.45
--- Pattern.java 28 Apr 2003 18:10:29 -0000 1.46
***************
*** 50,61 ****
It must be a super-class of <code>tc</code>.
It is only used for overloading resolution, not at runtime.
! @param type a monotype that must be equal to
! the argument's runtime type. This is usefull to introduce
! a type constructor variable with the exact type of the argument.
*/
public Pattern(LocatedString name,
TypeIdent tc, Expression atValue,
boolean exactlyAt, TypeIdent additional,
! bossa.syntax.Monotype type,
Location location)
{
--- 50,60 ----
It must be a super-class of <code>tc</code>.
It is only used for overloading resolution, not at runtime.
! @param runtimeTC a type constructor that will be bound to
! the argument's runtime class.
*/
public Pattern(LocatedString name,
TypeIdent tc, Expression atValue,
boolean exactlyAt, TypeIdent additional,
! TypeConstructor runtimeTC,
Location location)
{
***************
*** 63,67 ****
this.typeConstructor = tc;
this.additional = additional;
! this.type = type;
this.atValue = atValue;
this.exactlyAt = exactlyAt;
--- 62,66 ----
this.typeConstructor = tc;
this.additional = additional;
! this.runtimeTC = runtimeTC;
this.atValue = atValue;
this.exactlyAt = exactlyAt;
***************
*** 148,154 ****
! final mlsub.typing.Monotype getType()
{
! return t;
}
--- 147,153 ----
! final TypeConstructor getRuntimeTC()
{
! return runtimeTC;
}
***************
*** 184,196 ****
}
- void resolveType(TypeScope scope)
- {
- if(type!=null)
- {
- t = type.resolve(scope);
- type = null;
- }
- }
-
static void resolveTC(TypeScope scope, Pattern[] patterns)
{
--- 183,186 ----
***************
*** 199,208 ****
}
- static void resolveType(TypeScope scope, Pattern[] patterns)
- {
- for(int i = 0; i < patterns.length; i++)
- patterns[i].resolveType(scope);
- }
-
/****************************************************************
* Type checking
--- 189,192 ----
***************
*** 583,588 ****
public TypeConstructor tc;
TypeConstructor tc2;
! private bossa.syntax.Monotype type;
! private mlsub.typing.Monotype t;
// The class constraint verified by this pattern.
--- 567,571 ----
public TypeConstructor tc;
TypeConstructor tc2;
! private TypeConstructor runtimeTC;
// The class constraint verified by this pattern.
Index: MethodBodyDefinition.java
===================================================================
RCS file: /cvsroot/nice/Nice/src/bossa/syntax/MethodBodyDefinition.java,v
retrieving revision 1.118
retrieving revision 1.119
diff -C2 -d -r1.118 -r1.119
*** MethodBodyDefinition.java 25 Apr 2003 17:21:26 -0000 1.118
--- MethodBodyDefinition.java 28 Apr 2003 18:10:30 -0000 1.119
***************
*** 51,55 ****
LocatedString name,
Collection binders,
- List newTypeVars,
List formals,
Statement body)
--- 51,54 ----
***************
*** 62,68 ****
this.body = body;
this.declaration = null;
- if (newTypeVars != null)
- this.newTypeVars = (TypeConstructor[])
- newTypeVars.toArray(new TypeConstructor[newTypeVars.size()]);
this.insideClass = container != null ||
--- 61,64 ----
***************
*** 107,124 ****
Pattern p = names[tn];
! MonotypeVar type;
! if (p.name == null)
! // anonymous pattern
! type = new MonotypeVar("anonymous argument " + tn);
else
- // XXX optimize using this:
- // type = new MonotypeVar("type(" + p.name + ")<" + types[tn]);
{
! LocatedString typeName;
! typeName = p.name.cloneLS();
! typeName.prepend("type(");
! typeName.append(")<" + types[tn]);
! type = new MonotypeVar(typeName.toString());
}
--- 103,132 ----
Pattern p = names[tn];
! Monotype type;
! if (p.getRuntimeTC() != null)
! {
! AtomicKind v = p.tc.variance;
! p.getRuntimeTC().setVariance(v);
! type = new mlsub.typing.MonotypeConstructor(p.getRuntimeTC(), mlsub.typing.MonotypeVar.news(v.arity()));
! type.setKind(v);
!
! type = bossa.syntax.Monotype.sure(type);
! }
else
{
! if (p.name == null)
! // anonymous pattern
! type = new MonotypeVar("anonymous argument " + tn);
! else
! // XXX optimize using this:
! // type = new MonotypeVar("type(" + p.name + ")<" + types[tn]);
! {
! LocatedString typeName;
! typeName = p.name.cloneLS();
! typeName.prepend("type(");
! typeName.append(")<" + types[tn]);
! type = new MonotypeVar(typeName.toString());
! }
}
***************
*** 291,304 ****
}
- if (newTypeVars != null)
try{
! typeScope.addSymbols(newTypeVars);
}
catch(TypeScope.DuplicateName e) {
User.error(this, e);
}
-
- // We can resolve now
- Pattern.resolveType(this.typeScope, formals);
}
--- 299,313 ----
}
try{
! for(int n = 0; n < formals.length; n++)
! {
! TypeConstructor tc = formals[n].getRuntimeTC();
! if (tc != null)
! typeScope.addSymbol(tc);
! }
}
catch(TypeScope.DuplicateName e) {
User.error(this, e);
}
}
***************
*** 354,378 ****
for(int n = 0; n < formals.length; n++)
{
! Pattern pat = formals[n];
! Monotype type = pat.getType();
! if (type == null)
Typing.introduce(monotypes[n]);
else
! {
! parameters[n].type = monotypes[n] = type;
!
! // We need to find the variance of the constructor.
! // This is the only case where a type constructor is created
! // without a known variance. But we can get it easily from the
! // pattern.
! TypeConstructor tc = Types.rawType(type).head();
! if (tc != null && tc.variance == null)
! tc.setVariance(pat.tc.variance);
! }
}
- if (newTypeVars != null)
- Typing.introduce(newTypeVars);
-
// The arguments are specialized by the patterns
try{
--- 363,373 ----
for(int n = 0; n < formals.length; n++)
{
! TypeConstructor runtimeTC = formals[n].getRuntimeTC();
! if (runtimeTC == null)
Typing.introduce(monotypes[n]);
else
! Typing.introduce(runtimeTC);
}
// The arguments are specialized by the patterns
try{
***************
*** 543,547 ****
private Pattern[] formals;
Collection /* of LocatedString */ binders; // Null if type parameters are not bound
- private TypeConstructor[] newTypeVars;
private Statement body;
private boolean insideClass;
--- 538,541 ----
|
|
From: <bo...@us...> - 2003-04-28 15:49:33
|
Update of /cvsroot/nice/Nice/src/bossa/syntax
In directory sc8-pr-cvs1:/tmp/cvs-serv20549/src/bossa/syntax
Modified Files:
typecheck.nice analyse.nice
Log Message:
Restricted variables for which type is inferred to have a monomorphic type.
This avoids the polymorphic reference problem, in a restrictive manner.
Index: typecheck.nice
===================================================================
RCS file: /cvsroot/nice/Nice/src/bossa/syntax/typecheck.nice,v
retrieving revision 1.58
retrieving revision 1.59
diff -C2 -d -r1.58 -r1.59
*** typecheck.nice 24 Apr 2003 12:29:42 -0000 1.58
--- typecheck.nice 28 Apr 2003 15:49:23 -0000 1.59
***************
*** 561,565 ****
{
typecheck(decl.value);
! notNull(decl.left).type = notNull(decl.value).getType();
}
--- 561,580 ----
{
typecheck(decl.value);
! mlsub.typing.Polytype type = notNull(decl.value).getType();
! notNull(decl.left).type = type;
!
! // Check that the type is not polymorphic, as this could be unsafe.
! if (type.isMonomorphic())
! return;
!
! type.simplify();
! if (type.isMonomorphic())
! return;
!
! throw new bossa.util.UserError
! (decl,
! "The value has a polymorphic type: " + type +
! "\nOmitting the type here is not supported by Nice yet." +
! "\nPlease declare the monomorphic type of " + decl.getName());
}
Index: analyse.nice
===================================================================
RCS file: /cvsroot/nice/Nice/src/bossa/syntax/analyse.nice,v
retrieving revision 1.59
retrieving revision 1.60
diff -C2 -d -r1.59 -r1.60
*** analyse.nice 24 Apr 2003 12:32:17 -0000 1.59
--- analyse.nice 28 Apr 2003 15:49:27 -0000 1.60
***************
*** 33,37 ****
buildInfo(varScope, typeScope)
{
! final t = new SymbolTable();
return new Info(vars: new SymbolTable(), typeVars: t,
outerVarScope: varScope, outerTypeScope: typeScope,
--- 33,37 ----
buildInfo(varScope, typeScope)
{
! final SymbolTable<TypeSymbol> t = new SymbolTable();
return new Info(vars: new SymbolTable(), typeVars: t,
outerVarScope: varScope, outerTypeScope: typeScope,
|
|
From: <bo...@us...> - 2003-04-28 15:49:32
|
Update of /cvsroot/nice/Nice/testsuite/compiler/statements/variables
In directory sc8-pr-cvs1:/tmp/cvs-serv20549/testsuite/compiler/statements/variables
Added Files:
typeInference.testsuite
Log Message:
Restricted variables for which type is inferred to have a monomorphic type.
This avoids the polymorphic reference problem, in a restrictive manner.
--- NEW FILE: typeInference.testsuite ---
/// PASS
final x = 3;
int y = x + 1;
/// FAIL
// An incorrect use of a polymorphic reference.
final /* /// FAIL HERE */ l = new ArrayList();
l.add("Hello");
java.io.File f = l.get(0);
|
|
From: <bo...@us...> - 2003-04-28 11:44:47
|
Update of /cvsroot/nice/tester In directory sc8-pr-cvs1:/tmp/cvs-serv25333 Added Files: .cvsignore Log Message: Ignore config (which is site-dependent) and generated files. --- NEW FILE: .cvsignore --- builds config.* setup |
|
From: <ar...@us...> - 2003-04-28 11:39:44
|
Update of /cvsroot/nice/Nice/testsuite/compiler/methods
In directory sc8-pr-cvs1:/tmp/cvs-serv23595/F:/nice/testsuite/compiler/methods
Added Files:
constrained.testsuite
Log Message:
Source of bug #728844
--- NEW FILE: constrained.testsuite ---
///PASS bug
///Toplevel
class A{}
class B extends A{}
interface I<A T>{}
class X<T | A <: T> implements I<T>{}
void foo(I<B>);
|
|
From: <bo...@us...> - 2003-04-28 11:10:59
|
Update of /cvsroot/nice/tester
In directory sc8-pr-cvs1:/tmp/cvs-serv12233
Modified Files:
Flow4j.test
Log Message:
Use the new permanent URL to get the latest version of the sources.
Index: Flow4j.test
===================================================================
RCS file: /cvsroot/nice/tester/Flow4j.test,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -C2 -d -r1.1.1.1 -r1.2
*** Flow4j.test 26 Apr 2003 22:22:13 -0000 1.1.1.1
--- Flow4j.test 28 Apr 2003 11:10:55 -0000 1.2
***************
*** 1,3 ****
! #! /bin/sh
set -e
--- 1,5 ----
! #! /bin/sh -x
!
! SOURCES=flow4j-src-latest.tar.gz
set -e
***************
*** 5,12 ****
if [ ! -r flow4j ]; then
if [ ! -r flow4j-src-0.5.tar.gz ]; then
! wget http://cesnet.dl.sourceforge.net/sourceforge/flow4j/flow4j-src-0.5.tar.gz
fi
mkdir flow4j
! tar zxf flow4j-src-0.5.tar.gz -C flow4j
chmod a+x flow4j/build.sh
fi
--- 7,14 ----
if [ ! -r flow4j ]; then
if [ ! -r flow4j-src-0.5.tar.gz ]; then
! wget http://flow4j.sf.net/releases/${SOURCES}
fi
mkdir flow4j
! tar zxf ${SOURCES} -C flow4j
chmod a+x flow4j/build.sh
fi
|
|
From: <bo...@us...> - 2003-04-27 22:20:10
|
Update of /cvsroot/nice/Nice/web In directory sc8-pr-cvs1:/tmp/cvs-serv4593/web Modified Files: .cvsignore Log Message: Ignore PDF and PS files, they are generated. Index: .cvsignore =================================================================== RCS file: /cvsroot/nice/Nice/web/.cvsignore,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** .cvsignore 18 Oct 2002 09:09:53 -0000 1.8 --- .cvsignore 27 Apr 2003 22:20:06 -0000 1.9 *************** *** 7,8 **** --- 7,10 ---- safety.html testimonials.html + *.pdf + *.ps |
|
From: <ar...@us...> - 2003-04-27 20:21:37
|
Update of /cvsroot/nice/Nice/web
In directory sc8-pr-cvs1:/tmp/cvs-serv28396/F:/nice/web
Modified Files:
language.html safety.xml
Log Message:
Updated the syntax of the code use in examples.
Index: language.html
===================================================================
RCS file: /cvsroot/nice/Nice/web/language.html,v
retrieving revision 1.18
retrieving revision 1.19
diff -C2 -d -r1.18 -r1.19
*** language.html 18 Apr 2003 14:50:16 -0000 1.18
--- language.html 27 Apr 2003 20:21:33 -0000 1.19
***************
*** 257,261 ****
{ ... }
! <font color="#CD0000">main</font>(args)
{
<font color="#B7860B">List</font><<font color="#B7860B">int</font>> <font color="#CD0000">l1</font>;
--- 257,261 ----
{ ... }
! <font color="#CD0000">void main</font>(String[] args)
{
<font color="#B7860B">List</font><<font color="#B7860B">int</font>> <font color="#CD0000">l1</font>;
***************
*** 315,319 ****
<pre><<font color="#B7860B">Any</font> T> T <font color="#CD0000">clone</font>(T);
! <font color="#CD0000">main</font>(args)
{
java.util.Date d1;
--- 315,319 ----
<pre><<font color="#B7860B">Any</font> T> T <font color="#CD0000">clone</font>(T);
! <font color="#CD0000">void main</font>(String[] args)
{
java.util.Date d1;
***************
*** 354,358 ****
<li>
<b>Closures</b> (functions written inside expressions). The expression
! <tt>fun(T1
p1, T2 p2)=>e</tt> is the two parameters function that returns
<tt>e</tt>.
--- 354,358 ----
<li>
<b>Closures</b> (functions written inside expressions). The expression
! <tt>(T1
p1, T2 p2)=>e</tt> is the two parameters function that returns
<tt>e</tt>.
***************
*** 360,364 ****
it. Parameters <tt>p1</tt> and <tt>p2 </tt>can of course occur in <tt>e</tt>.
Outside variables can also safely occur in e, in which case their <b>reference</b>
! is captured (not their value). An alternate syntax is <tt>fun(T1 p1, T2
p2)=>{ inst1; ...; instn; }</tt>. Every execution of the body should lead
to a return statement. The return type of the function is the lowest common
--- 360,364 ----
it. Parameters <tt>p1</tt> and <tt>p2 </tt>can of course occur in <tt>e</tt>.
Outside variables can also safely occur in e, in which case their <b>reference</b>
! is captured (not their value). An alternate syntax is <tt>(T1 p1, T2
p2)=>{ inst1; ...; instn; }</tt>. Every execution of the body should lead
to a return statement. The return type of the function is the lowest common
***************
*** 447,451 ****
=</tt>
<br><tt> native Object java.util.Map.get(Object);</tt>
! <br>
<p>Calling Nice code from Java is also possible.
When calling a Nice method <tt>m</tt> declared in package
--- 447,454 ----
=</tt>
<br><tt> native Object java.util.Map.get(Object);</tt>
! <br><br>
! Retyping can be more complex in practice but the java.util package is
! already retyped in the compiler so you don't have to worry about it.
! <br>
<p>Calling Nice code from Java is also possible.
When calling a Nice method <tt>m</tt> declared in package
Index: safety.xml
===================================================================
RCS file: /cvsroot/nice/Nice/web/safety.xml,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** safety.xml 3 Jan 2002 10:54:37 -0000 1.1
--- safety.xml 27 Apr 2003 20:21:34 -0000 1.2
***************
*** 334,338 ****
<para>
<programlisting lang="nice">
! private List<Component> children(Component);
children(c@Component) = null;
--- 334,338 ----
<para>
<programlisting lang="nice">
! private ?List<Component> children(Component);
children(c@Component) = null;
***************
*** 346,350 ****
Component c = ...;
! List<Component> children = children(c);
</programlisting>
</para>
--- 346,350 ----
Component c = ...;
! ?List<Component> children = children(c);
</programlisting>
</para>
***************
*** 370,374 ****
Component c = ...;
! List<Component> children;
if (c instanceof ContainerComponent)
children = c.getChildren();
--- 370,374 ----
Component c = ...;
! ?List<Component> children;
if (c instanceof ContainerComponent)
children = c.getChildren();
***************
*** 511,515 ****
can also be written in &nice;
<programlisting lang="nice">
! a.iter( fun(int i) => doSomething );
</programlisting>
Using these functions makes the code somewhat clearer by avoiding the
--- 511,515 ----
can also be written in &nice;
<programlisting lang="nice">
! a.foreach( int i => doSomething );
</programlisting>
Using these functions makes the code somewhat clearer by avoiding the
|
|
From: <bo...@us...> - 2003-04-27 19:32:31
|
Update of /cvsroot/nice/Nice/testsuite/compiler/typing
In directory sc8-pr-cvs1:/tmp/cvs-serv11429/testsuite/compiler/typing
Modified Files:
null.testsuite
Log Message:
Modified a test involving Swing so that it does not need a working DISPLAY
to run. It broke on remote machines that have none (for tests).
This is a typing test anyway.
Index: null.testsuite
===================================================================
RCS file: /cvsroot/nice/Nice/testsuite/compiler/typing/null.testsuite,v
retrieving revision 1.6
retrieving revision 1.7
diff -C2 -d -r1.6 -r1.7
*** null.testsuite 21 Feb 2003 15:19:20 -0000 1.6
--- null.testsuite 27 Apr 2003 19:32:26 -0000 1.7
***************
*** 14,19 ****
/// PASS
- javax.swing.JFrame f = new javax.swing.JFrame().init();
/// Toplevel
<java.awt.Component T> T init
--- 14,22 ----
/// PASS
/// Toplevel
+ void foo()
+ {
+ javax.swing.JFrame f = new javax.swing.JFrame().init();
+ }
<java.awt.Component T> T init
|