Trying to work newer indy into JRuby

Rémi Forax forax at univ-mlv.fr
Tue May 19 12:30:45 PDT 2009


Charles Oliver Nutter a écrit :
> Rémi Forax wrote:
>   
>> If you take a close look to the current API:
>> http://download.java.net/jdk7/docs/api/java/dyn/MethodHandles.html
>> there are not lot of primitive adapters, i.e adapters that can not be 
>> written from
>> the others.
>>     
>
> Are these all functional right now? I could obviously use guardWithTest 
> for my guarded handles without having custom Java code for it.
>   

I think guardWithTest is functional but based on spread/collect if there 
is more than one element.
See sun.dyn.MethodHandleImpl so in my opinion, custom Java will be faster.

>   
>> The purpose of primitive adapters is to hep the language developer to fight
>> the inherent complexity of dealing with polymorphic signature.
>>
>> In case of Jython or JRuby (correct me if I'm wrong) but current 
>> implementation
>> massively use method with object as parameter type.
>>
>> In that case, guards etc can be implemented using only convert, spread 
>> and collect
>> and the JavaMethodHandle.
>>
>> But, for my pet project, for Groovy or for Neal's closure, you have to 
>> deal with
>> signatures including primitive types.
>> In that case, insert/drop, permute and combine/guardWithTest are very 
>> useful.
>>     
>
> Actually we have as much need for the primitive support as Groovy, since 
> we integrate almost as well with Java libraries and have a need to 
> eliminate all the intermediate layers from our call protocols to and 
> from Java code.
>
> The current collection of primitive MHs already makes me giddy.
>   

Ooups, sorry, I forget that we don't live in a closed world :)


> - Charlie
>   
Rémi



More information about the mlvm-dev mailing list