A syntax option (function types versus arrays)

Peter Levart peter.levart at marand.si
Tue Mar 2 02:27:08 PST 2010


On Tuesday 02 March 2010 11:16:40 Peter Levart wrote:
> On Tuesday 02 March 2010 03:01:40 Joshua Bloch wrote:
> > Neal,
> > 
> > I don't find this argument convincing. As I understand it, you're saying
> > that function types and disjunction types will have the same level of
> > runtime support as generics. So they should have the same level of
> > expressiveness as well: it should be possible to describe, but not create
> > (except implicitly for varargs) arrays of these types.
> > 
> >    Josh
> > 
> 
> The same level of expressiveness could be achived if we had a denotable form of common function supertype: FT (which could be different in syntax from function types in general).
> 
> In analogy with the following:
> 
> new List<String>[10]    // illegal
> new List[10]   // legal
> 
> The function types variant:
> 
> new (int -> int)[10]   // illegal
> new FT[10]   // legal
> 
> 
> I wouldn't equate FT with MethodHandle since that would be an implementation detail. I wouldn't equate it with a marker interface either. The specification could just define it as a way to create arrays of raw function type. But is this any better than new Object[] ?
> 
> Regards, Peter
> 
> 

No, I'm wrong this time. You were asking for the same level of expresivenes in specifying arrays of function type not creating instances of them.

Peter


More information about the lambda-dev mailing list