Jim White a écrit :
> Jochen Theodorou wrote:
>
>   
>> ...
>> anyway I will outline the process in Groovy:
>>
>> 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
>> ...
>>     

You can use a bit set instead of a list, the paper* A Reflective 
Implementation of Java Multi-Methods
in reference of this mailing list
(http://groups.google.com/group/jvm-languages/web/implementation-of-multimethods-in-jvm-languages)
explain how to do that.
*
> I hope that list gets used multiple times.  Otherwise it would be better 
> performance-wise (particularly wrt garbage), at the expense of somewhat 
> more convoluted code since we don't have continuations, to just search 
> for the nearest match (with a flag for the multiple match condition) 
> rather than building a list.
>
> The important thing is to make sure that the prospective method list for 
> every case is clearly specified and documented.  Ditto for the 
> precedence calculation.
>
> Jim
>
>   
Rémi

--~--~---------~--~----~------------~-------~--~----~
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