W3C home > Mailing lists > Public > public-rif-wg@w3.org > April 2007

Re: foo(foo) and foo(foo()) etc...

From: Chris Welty <cawelty@gmail.com>
Date: Wed, 18 Apr 2007 20:21:20 -0400
Message-ID: <4626B600.6090003@gmail.com>
To: Hassan Aït-Kaci <hak@ilog.com>
CC: W3C RIF WG <public-rif-wg@w3.org>


In the hope that it helps clarify further, Java is ONDS according to 
the labels I made up: The functions foo and the class variable foo are 
different things that happen to have the same name.

This example introduces overloading, in which the distinction between 
the two functions comes from its signature - this is another dimension 
that isn't covered by the four categories I suggested, but is orthogonal.

-Chris

Hassan Aït-Kaci wrote:
> Sandro (and the rest who still cling to separate names for separate 
> things),
> please save the enclosed file, run 'javac' on it, then 'java 
> ExampleForSandro'.
> 
> There - convinced?
> 
> -hak
> 
> 
> ------------------------------------------------------------------------
> 
> public class ExampleForSandro
> {
>   static String foo = "Hi Sandro!";
> 
>   static String foo ()
>     {
>       return (foo = "... and the the rest of the RIF gang ... :-)");
>     }
> 
>   static void foo (String s)
>     {
>       System.out.println(s);
>     }
> 
>   static public void main (String[] args)
>     {
>       foo(foo);
>       foo(foo());
>     }
> }

-- 
Dr. Christopher A. Welty                    IBM Watson Research Center
+1.914.784.7055                             19 Skyline Dr.
cawelty@gmail.com                           Hawthorne, NY 10532
http://www.research.ibm.com/people/w/welty
Received on Thursday, 19 April 2007 00:21:36 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Tuesday, 2 June 2009 18:33:38 GMT