Function types versus arrays

Reinier Zwitserloot reinier at zwitserloot.com
Fri Feb 12 20:22:15 PST 2010


On Tue, Feb 9, 2010 at 7:01 AM, Howard Lovatt <howard.lovatt at iee.org> wrote:

> Well you *speculate* that reified lambdas are type unsound, you haven't and
> nor has anyone else demonstrated that - in fact quite the opposite.
>

Well, you *speculate* that disallowing arrays of functional types is 'just
not java', but you haven't demonstrated that.

Arrays, really? They're almost deprecated at this point. As long as function
types are legal in generics, and any usage in arrays is flagged with a clear
error, I doubt the greater java community is going to get out the tar and
feathers.

However, if function types aren't reified, then arrays are the least of my
worries. Does that mean something like this:

void print(#(Number)String formatter, Number number) {
    System.out.println(formatter.(number));
}

void print(#(String)String formatter, String string) {
    System.out.println(formatter.(string));
}

is not legal (if this is done like generics, the signatures are equal
post-erasure, which is a compile error).

 --Reinier Zwitserloot


More information about the lambda-dev mailing list