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 the call and the method >> 4) the method with my minimum distance will be selected >> 5) if at the end I have two or more methods with the same minimum >> distance I have to report an error > ... >> So.. how do other languages do that? > > I'm not going to try to describe the JRuby way, because it's not > nearly > as good as we'd like it. What I would like to do is say we need "one > way" we can use to do this method selection and dispatch in all our > languages. > > Attila mentioned that he had been working on a library to do dynamic > dispatch on Java types according to the specified behavior that javac > follows for static dispatch, and I presume he meant the MOP library > that's now available in release form. If that's the case, it would > be an > additional, very compelling reason for us to try to back that > library by > implementing the interfaces in our language impls. Yup, it's all implemented. See <http://dynalang.svn.sourceforge.net/viewvc/dynalang/trunk/dynalang/src/org/dynalang/mop/beans/ > OverloadedDynamicMethod is the class you're looking for. It further relies on both OverloadedFixArgMethod and OverloadedVarArgMethod, which implement the actual nitty-gritty details for fixedarg overloads and vararg overloads of a method, respectively. > I've already done a > first pass in JRuby, and it's not a hard process; if both Groovy and > JRuby implemnted the interfaces (or a version of then we could evolve > out of discussion) Speaking of which, I think I'm still waiting for your input on the details of the method-selector functionality (not intending to rush you, though). > we might mutually gain the benefit of Attila's Java > types MOP for free, and have consistent dispatch behavior across both > languages. > > - Charlie Attila. -- home: http://www.szegedi.org weblog: http://constc.blogspot.com --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "JVM Languages" group. To post to this group, send email to jvm-languages@googlegroups.com 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 -~----------~----~----~----~------~----~------~--~---