Attila Szegedi schrieb:
[...}
> Also, I'm talking solely about the problem of selecting among  
> overloaded Java methods invoked from a dynamic language here. Dynamic  
> languages are better off without a concept of an overloaded method  
> altogether, as they can mostly have a single method accepting any  
> types of arguments anyway :-)

might be that dynamic languages are better of without overloaded 
methods, but in case of Groovy we have a static/dynamic hybrid and once 
we are in the MetaClass we handle java types and Groovy types the same. 
For example we have a type called GString, that is handled as if it is a 
sublcass of String. That means if I want to call a method taking a 
String, then I need to coerce the GString to a String. But on the other 
hand GString is a java class too and might as such appear in the method 
header of a normal java class.

If we now have these methods:

def foo(String s)
def foo(GString s)

then your common type would be String, because we handle GString as 
String, then we would coerce the GString to String and in the we would 
call the String method... That would be strange, because our call was 
with a GString object, so we intend to call the GString method. If we go 
with the rules of the java class system, then the common type would be 
Object I guess, not sure if you use interfaces... anyway, in case of 
Object no coercion would happen...looks like I still don't get this 
common type thing.

which reminds me what happens if the signature contains an interface?

bye blackdrag


-- 
Jochen "blackdrag" Theodorou
The Groovy Project Tech Lead (http://groovy.codehaus.org)
http://blackdragsview.blogspot.com/
http://www.g2one.com/

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "JVM 
Languages" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/jvm-languages?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to