Hi all,

I am sorry that I can not spend much time on this list atm, I am feed up 
with the 1.1 Groovy release... yesterday I fixed some bugs in the method 
selection process and I began to as how other languages do the selection 
process, because the Groovy way is a bit complicated and maybe we find 
some improvements. This will could speed up the method selection process 
very much for more than only Groovy. Of course I know that this depends 
on the language very much too.. I am which calls are valid and which 
overloaded method should be preferred over another overloaded method and 
these things.  And I am not sure that many languages have to deal with 
this kind of thing at runtime...

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

this distance calculation consists of calculating a distance between 
parameter class and argument class (class distance) and then sum it up 
for all of them plus additional functionality for vargs. This class 
distance consists for normal classes of counting how many super classes 
of the argument class I have to go through until I meat the parameter 
class. the algorithm gets even more complicated through interfaces and 
primitive types.

An improvement would be to not to calculate this distance directly, but 
to calculate a distance to a generalized call and then cache it for the 
method... if it works well, then a simple subtraction (plus vargs) would 
give the distance and this would be pretty fast then.

So.. how do other languages do that?

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