Latest Thinking

Howard Lovatt howard.lovatt at gmail.com
Tue Jun 22 16:24:54 PDT 2010


Rémi Forax forax at univ-mlv.fr Tue Jun 22 05:30:48 PDT 2010 wrote:
> Le 22/06/2010 12:48, Howard Lovatt a écrit :
>> A couple of comments on the current MethodHandle API:
>>
>> 1. Having only one bootstrap method for InvokeDynamic is a bit
>> limiting, it it possible to have one per use site?
>>
>
> It's an open issue, we're working on it.

With multiple dispatch the problem is that you can have more than one
multiple dispatch per class, hence one bootstrap is limiting. Defining
an instance of InvokeDynamic might work, e.g. using my cost multiple
dispatch example:

private static final InvokeDynamic costDistpatch = new InvokeDynamic(
double.class, callerClass.class, bootstrapHandle ); // note return
type, double, encoded
...
cost += costDistpatch.invoke( costCalculator, item ); // no need for
method name since we have unique InvokeDynamic instance

>> 2. Has thought been given to using the .( args ) notation (or what
>> ever it ends up as) from lambda dev for invokeGeneric( args )?
>>
>
> My opinion is that the lambda spec has to mature a little bit
> before looking at this kind of things.
> Currently, the lambda super type is not MethodHandle but Object

Yes, if lamda-dev uses MethodHandle, which seems likely, it would be
nice to unify them to the extent that a lambda 'is a' MethodHandle.

>> 3. Are there plans to add MethodHandle literals, e.g. Class#method( types )?
>>
>
> The mlvm workspace already contains method handle literals :)

Good to see

>> 4. Assuming 3 above; are there plans for a binding literal, e.g.
>> MethodHandle addA = String#concat( String, "A" )?
>
> As far as I know, No.
> I don't think it worth the introduction of a new syntax
>
> MethodHandle addA = insertArguments(String#concat( String, String ), 1, "A");
>
>
> Morever, your proposed syntax has a bad property.
> It allow type and expression to occur at the same place.

As John has pointed out in this thread it does exist for binding
'this'. An extension to all arguments would be useful, because like
the method literal it would be compiler, rather than runtime, checked.
I don't think there is confusion between a type name and a value,
therefore proposed syntax OK (but maybe not the preferred). If you
want a class you have to append '.class'.

> I am sure these items have been already discussed in the expert group,
> just wondering what the latest thinking is.
>
>    -- Howard.
>

cheers,
Rémi

-- 
  -- Howard.


More information about the mlvm-dev mailing list