[Nice-commit] Nice/web language.html,1.18,1.19 safety.xml,1.1,1.2
Brought to you by:
bonniot
|
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
|