Function types versus arrays

Alex Buckley Alex.Buckley at Sun.COM
Thu Feb 11 15:06:22 PST 2010


Neal Gafter wrote:
> I've been asked if arrays and function types will play nicely
> together.  Specifically, for example, whether or not something like
> the following will be allowed:
> 
> #String(String)[] arrayOfFunction = new #String(String)[10];
> 
> The current draft spec, by the absence of any constraining rules,
> implies yes.  

Finishing up here for now, the 0.1 draft spec doesn't fully imply "yes".

- It proposes no changes to JLS3 15.10, so an array creation expression 
syntactically cannot have a function type as the element type.

- It proposes no changes to JLS3 10.6, so an array initializer for a 
function-type array is possible iff function types are reifiable. For 
now, they are not reifiable, and I will tweak JLS3 4.7 to exclude them.

- It implicitly allows, and will continue to allow, an array type whose 
element type is a function type.

Alex


More information about the lambda-dev mailing list