Update of /cvsroot/nice/Nice/web
In directory sc8-pr-cvs1:/tmp/cvs-serv15755/web
Modified Files:
language.html
Log Message:
Use the new syntax for method dispatch.
Index: language.html
===================================================================
RCS file: /cvsroot/nice/Nice/web/language.html,v
retrieving revision 1.20
retrieving revision 1.21
diff -C2 -d -r1.20 -r1.21
*** language.html 30 May 2003 12:06:07 -0000 1.20
--- language.html 23 Dec 2003 11:31:46 -0000 1.21
***************
*** 61,70 ****
<b>implementations</b> for method <tt>display</tt>:
<PRE>
! <FONT COLOR="#cd0000">display</FONT>(p<FONT COLOR="#0000ee">@</FONT><FONT COLOR="#b7860b">Person</FONT>)
{
<FONT COLOR="#0000ee">return</FONT> p.name + <FONT COLOR="#a020f0">" (age="</FONT> + p.age + <FONT COLOR="#a020f0">")"</FONT>;
}
! <FONT COLOR="#cd0000">display</FONT>(p<FONT COLOR="#0000ee">@</FONT><FONT COLOR="#b7860b">Worker</FONT>)
{
<FONT COLOR="#0000ee">return</FONT> p.name + <FONT COLOR="#a020f0">" (age+"</FONT> + p.age + <FONT COLOR="#a020f0">", salary="</FONT> + p.salary + <FONT COLOR="#a020f0">")"</FONT>;
--- 61,70 ----
<b>implementations</b> for method <tt>display</tt>:
<PRE>
! <FONT COLOR="#cd0000">display</FONT>(<FONT COLOR="#b7860b">Person</FONT> p)
{
<FONT COLOR="#0000ee">return</FONT> p.name + <FONT COLOR="#a020f0">" (age="</FONT> + p.age + <FONT COLOR="#a020f0">")"</FONT>;
}
! <FONT COLOR="#cd0000">display</FONT>(<FONT COLOR="#b7860b">Worker</FONT> p)
{
<FONT COLOR="#0000ee">return</FONT> p.name + <FONT COLOR="#a020f0">" (age+"</FONT> + p.age + <FONT COLOR="#a020f0">", salary="</FONT> + p.salary + <FONT COLOR="#a020f0">")"</FONT>;
***************
*** 124,128 ****
}
! <font color="#CD0000">equals</font>(p1<font color="#0000EE">@</font><font color="#B7860B">Person</font>, p2<font color="#0000EE">@</font><font color="#B7860B">Person</font>) =
p1.name.equals(p2.name) &&
p1.age==p2.age;</pre>
--- 124,128 ----
}
! <font color="#CD0000">equals</font>(<font color="#B7860B">Person</font> p1, <font color="#B7860B">Person</font> p2) =
p1.name.equals(p2.name) &&
p1.age==p2.age;</pre>
***************
*** 386,391 ****
<li>
! <b>Functional-like syntax for method implementations</b>. One can write <tt>f(x@P)
! = e; </tt>as an equivalent form for <tt>f(x@p) { return e; }</tt>. This
is very handy when defining methods that return simple values, depending
on the type of the argument -- that is doing <i>pattern-matching</i>.</li>
--- 386,391 ----
<li>
! <b>Functional-like syntax for method implementations</b>. One can write <tt>f(P x)
! = e; </tt>as an equivalent form for <tt>f(P x) { return e; }</tt>. This
is very handy when defining methods that return simple values, depending
on the type of the argument -- that is doing <i>pattern-matching</i>.</li>
|