|
|
 | | From: | Isaac Gouy | | Subject: | Re: Static vs dynamic | | Date: | 18 Jan 2005 10:23:58 -0800 |
|
|
 | > Ad-hoc overloading is available in statically typed languages. Please provide a code example, with user-defined functions.
|
|
 | | From: | Thomas G. Marshall | | Subject: | Re: Static vs dynamic | | Date: | Wed, 19 Jan 2005 01:27:37 GMT |
|
|
 | Isaac Gouy coughed up: >> Ad-hoc overloading is available in statically typed languages. > Please provide a code example, with user-defined functions.
View this as pseudo-java, since we certainly don't need the hoo-haa of compilation adherence here.
somewhere....
public void print(int a) {...........}
public void print(String s) {.......}
elsewhere....
int i = 3; String s = "hello"; print(i); print(s);
As explained by Cardelli and Wegner in http://research.microsoft.com/Users/luca/Papers/OnUnderstanding.A4.pdf
"There are also two major kinds of ad-hoc polymorphism. In overloading the same variable name is used to denote different functions, and the context is used to decide which function is denoted by a particular instance of the name."
-- Forgetthesong,I'dratherhavethefrontallobotomy...
|
|
|