Function types versus arrays
Reinier Zwitserloot
reinier at zwitserloot.com
Fri Feb 12 20:51:20 PST 2010
reply at end of message.
On Mon, Feb 8, 2010 at 9:37 PM, Artur Biesiadowski <abies at adres.pl> wrote:
> What about having auto-generated interfaces (abstract classes?)
> representing lambdas in well known place? Something like java.gen.*,
>
>
On Mon, Feb 8, 2010 at 11:47 PM, Joshua Bloch <jjb at google.com> wrote:
> I just assumed that we'd do whatever it takes to make this works, up to and
> including VM changes ... And they may rightly accuse us of doing what was
> easy
> to implement rather than what is easy to use.
>
>
Doesn't the very existence of generics prevent either of these approaches?
Something like:
public <T> String format(#(T)String formatter, T object) {
return formatter.(object);
}
has a type in it: #(T)String, which cannot be turned into a java.gen.*
concept, nor can a more extensive VM-level integration give us reification
of function types, without generics itself being reified, which isn't on the
table for JDK7.
I agree with Josh's sentiments, except for one detail: We can already give
up on the idea, because it can't be done with reifying generics.
More information about the lambda-dev
mailing list