[Nice-commit] Nice/web language.html,1.17,1.18
Brought to you by:
bonniot
|
From: <bo...@us...> - 2003-04-18 14:50:54
|
Update of /cvsroot/nice/Nice/web
In directory sc8-pr-cvs1:/tmp/cvs-serv18316/web
Modified Files:
language.html
Log Message:
Allow implementations of native methods to dispatch on all their arguments.
Index: language.html
===================================================================
RCS file: /cvsroot/nice/Nice/web/language.html,v
retrieving revision 1.17
retrieving revision 1.18
diff -C2 -d -r1.17 -r1.18
*** language.html 25 Oct 2002 09:02:32 -0000 1.17
--- language.html 18 Apr 2003 14:50:16 -0000 1.18
***************
*** 147,159 ****
<td>
<blockquote>
! <pre>class Object
! {
! boolean equals(Object that)
! {
! return this == that;
! }
! }
!
! class Person extends Object
{
String name;
--- 147,151 ----
<td>
<blockquote>
! <pre>class Person
{
String name;
***************
*** 174,182 ****
<td>
<blockquote>
! <pre><<font color="#B7860B">Any</font> T> <font color="#B7860B">boolean</font> <font color="#CD0000">equals</font>(T, T);
!
! <font color="#CD0000">equals</font>(o1, o2) = o1==o2;
!
! <font color="#0000EE">class</font> <font color="#CD0000">Person
</font>{
<font color="#B7860B">String</font> <font color="#CD0000">name</font>;
--- 166,170 ----
<td>
<blockquote>
! <pre><font color="#0000EE">class</font> <font color="#CD0000">Person
</font>{
<font color="#B7860B">String</font> <font color="#CD0000">name</font>;
***************
*** 192,200 ****
</table></center>
! <p>In the Nice version, the last <tt>equals</tt> alternative will be executed
! when both parameters are instance of class <tt>Person</tt>.
So the type of the second argument is also known, and no manual
<tt>instanceof</tt> and no cast are necessary (red parts of the java code).
! This job is sort of automatically done by the compiler for you.
The code looks cleaner, it is simpler to understand,
and it is automatically guaranteed that no runtime exception will occur
--- 180,188 ----
</table></center>
! <p>In the Nice version, this implementation of <tt>equals</tt> will be executed
! when both parameters are instances of class <tt>Person</tt>.
So the type of the second argument is also known, and no manual
<tt>instanceof</tt> and no cast are necessary (red parts of the java code).
! This job is automatically done by the compiler for you.
The code looks cleaner, it is simpler to understand,
and it is automatically guaranteed that no runtime exception will occur
|