Lambda and JSR 292 method handle

Howard Lovatt howard.lovatt at iee.org
Fri Dec 18 08:03:45 PST 2009


My reading of John's paper is that this would be so, e.g.:

Ops.Op<? super String, ? extends Object> f1 = Lambda$1.instance;
Ops.Op<? super Object, ? extends String> f2 = Lambda$2.instance;
f1 = f2; // OK

With Ops.Op from the ParallelArray API (return type is the last
argument in this API!) and Lambda$1 etc. use the JavaMethodHandle
conversion I outlined in an earlier post.

 -- Howard.

2009/12/18 Neal Gafter <neal at gafter.com>:
>This doesn't answer my question.  I'm taking about subtyping among values of
>function type, not about the invocation point.  Specifically, it should be
>the case that, given
>
>*#Object(String) f1;*
>*#String(Object) f2 = ...;*
>
>you can assign
>
>*f1 = f2;*
>
>This needs to be a subtype conversion (e.g. no code should have to be
>generated for this conversion to occur) for reasons that I can explain if it
>is not already clear.  The ParallelArray APIs take advantage of this kind of
>subtyping by defining its function types using interfaces and wildcards.  If
>that API is recast using function types, some flexibility will be lost
>unless function types act this way too.
>
>The answer may depend on *how* function types are mapped to
>JavaMethodHandle.  There is no public proposal on the table yet for how that
>would work.  I hope the anonymous experts inside Sun that Mark suggested are
>devoted to this work are on it.
>
>Cheers,
>Neal


More information about the lambda-dev mailing list