[jvm-l] Re: selecting overloaded methods at runtime

2007-12-07 Thread Alex Tkachman
Isn't it what famous 'invokedynamic' targets for? Could anybody please direct me to any development done in this direction? On Dec 7, 2007 11:11 AM, Charles Oliver Nutter [EMAIL PROTECTED] wrote: Jochen Theodorou wrote: ... 1) build a list of all methods with the name of the method we want

[jvm-l] Re: selecting overloaded methods at runtime

2007-12-07 Thread David Welton
I'm not going to try to describe the JRuby way, because it's not nearly as good as we'd like it. I'd be curious just the same, to learn about what you like and dislike about your approach. I *just* started doing this work for Hecl (j2me doesn't have reflection, so it just didn't make sense),

[jvm-l] Re: selecting overloaded methods at runtime

2007-12-07 Thread Attila Szegedi
On 2007.12.07., at 9:11, Charles Oliver Nutter wrote: Jochen Theodorou wrote: ... 1) build a list of all methods with the name of the method we want to calls 2) remove the methods that are not valid for the call 3) if more than one method remains calculate the method distance between

[jvm-l] Re: selecting overloaded methods at runtime

2007-12-07 Thread Charles Oliver Nutter
Jochen Theodorou wrote: ... 1) build a list of all methods with the name of the method we want to calls 2) remove the methods that are not valid for the call 3) if more than one method remains calculate the method distance between the call and the method 4) the method with my minimum

[jvm-l] Re: selecting overloaded methods at runtime

2007-12-07 Thread John Wilson
On Dec 7, 2007 12:52 PM, Jochen Theodorou [EMAIL PROTECTED] wrote: John Wilson schrieb: [...] Groovy has this as a potential issue because it also supports optional typing. All that follows is a response to this and specific to Groovy: Actually I think the issue applies to any language

[jvm-l] Re: selecting overloaded methods at runtime

2007-12-07 Thread Jochen Theodorou
Attila Szegedi schrieb: [...] With that in mind I'll walk you through the code for fixarg resolution. line 100 of OverloadedFixArgMethod says: objMember = argTypes.getMostSpecific(members); argTypes is is an instanceof my ClassString class representing the actual arguments of the

[jvm-l] Re: selecting overloaded methods at runtime

2007-12-07 Thread Jochen Theodorou
John Wilson schrieb: [...] In general you can't just look at the type of a value and decide if it can be converted to another type. Also, in a dynamic language, the ability to convert from one type to another can appear or disappear at will. In Ng it's quite conceivable that I can convert C

[jvm-l] Re: selecting overloaded methods at runtime

2007-12-07 Thread Jochen Theodorou
Attila Szegedi schrieb: On 2007.12.07., at 9:11, Charles Oliver Nutter wrote: Jochen Theodorou wrote: ... 1) build a list of all methods with the name of the method we want to calls 2) remove the methods that are not valid for the call 3) if more than one method remains calculate the

[jvm-l] Re: selecting overloaded methods at runtime

2007-12-07 Thread John Wilson
On Dec 7, 2007 2:22 PM, Jochen Theodorou [EMAIL PROTECTED] wrote: Attila Szegedi schrieb: then the target types for argument conversion for all 2-arg overloads of foo will be computed to be [java.lang.String, java.util.Collection]. When the method is dynamically invoked, the passed

[jvm-l] Re: selecting overloaded methods at runtime

2007-12-07 Thread hlovatt
I prefer multiple dispatch to Visitor - for the same reasons as Attila outlined above plus with pattern matching you can have closed world problems (the so called 'expression problem'), poor error messages (Scala open patterns), and/or runtime errors (Mathematica). These problems with pattern

[jvm-l] Re: selecting overloaded methods at runtime

2007-12-07 Thread Charles Oliver Nutter
John Wilson wrote: Note *none* of the above require the dynamic language to support optional static typing so I think it's an issue for Jython and JRuby too. It's not nearly as much of an issue as you think. I tend to see categories of types here: integral types and composite types. When

[jvm-l] Re: selecting overloaded methods at runtime

2007-12-07 Thread Werner Schuster (murphee)
Attila Szegedi wrote: 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

[jvm-l] Re: selecting overloaded methods at runtime

2007-12-07 Thread Charles Oliver Nutter
Attila Szegedi wrote: 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

[jvm-l] Re: selecting overloaded methods at runtime

2007-12-07 Thread Charles Oliver Nutter
Jochen Theodorou wrote: if you say E#foo overwrites all older foo methods with the same number of parameters, then your problem is solved, or not? This is how it would be in JRuby as well...there's no capability in Ruby or in Java to explicitly invoke the superclass foo. The affordance we

[jvm-l] Re: selecting overloaded methods at runtime

2007-12-07 Thread Attila Szegedi
On 2007.12.07., at 21:06, Jochen Theodorou wrote: 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

[jvm-l] Re: selecting overloaded methods at runtime

2007-12-07 Thread Attila Szegedi
On 2007.12.08., at 3:05, Werner Schuster (murphee) wrote: Attila Szegedi wrote: 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

[jvm-l] Re: selecting overloaded methods at runtime

2007-12-07 Thread Attila Szegedi
On 2007.12.07., at 20:06, Charles Oliver Nutter wrote: John Wilson wrote: Note *none* of the above require the dynamic language to support optional static typing so I think it's an issue for Jython and JRuby too. It's not nearly as much of an issue as you think. I tend to see categories

[jvm-l] Re: selecting overloaded methods at runtime

2007-12-07 Thread Attila Szegedi
On 2007.12.07., at 15:39, John Wilson wrote: On Dec 7, 2007 2:22 PM, Jochen Theodorou [EMAIL PROTECTED] wrote: Attila Szegedi schrieb: then the target types for argument conversion for all 2-arg overloads of foo will be computed to be [java.lang.String, java.util.Collection]. When the