Function types versus arrays

Neal Gafter neal at gafter.com
Mon Feb 8 11:53:48 PST 2010


On Mon, Feb 8, 2010 at 11:43 AM, Lawrence Kesteloot <lk at teamten.com> wrote:
> On Mon, Feb 8, 2010 at 11:30 AM, Alex Buckley <Alex.Buckley at sun.com> wrote:
>> I am interested in people's thoughts on the limitations of arrays of
>> parameterized types.
>
> Could we ban the assignment to Object[]? Specifically, an array of
> function types cannot be assigned to an array of any superclass of the
> function type (including contra/covariant modifications). It's
> inconsistent, but so is banning arrays of function types.

You can't ban an assignment that is a widening reference conversion.
Even if you tried to ban it directly, there are lots of ways to work
around it (within the type system) using generics, or by doing
something like assigning it to Object and then casting to Object[].


More information about the lambda-dev mailing list