function types syntax

Neal Gafter neal at gafter.com
Tue Jan 5 15:59:59 PST 2010


On Tue, Jan 5, 2010 at 3:53 PM, Rémi Forax <forax at univ-mlv.fr> wrote:
> In this case, the only problematic point is that this syntax requires
> changes to the grammar that will be hard to implement.

I'm not sure whether or not that's true, but in any case it isn't
really an argument against the syntax.  The compiler only has to be
implemented once, while the benefits of an improved syntax (generally
speaking, presuming the syntax is better) accrue to all users of the
language.

Having said that, I believe a function type syntax using only parens
is hard to read, especially when combined with the shorthand
invocation syntax.  What does this mean:

(x(y))(z)

Perhaps it is casting the value of z to the function type x(y), or
perhaps it is invoking the method x on the argument y resulting in a
value of function type to be applied to the argument z.  We could come
up with rules to disambiguate them, but programmers will still get
confused.  That's why we abandoned the syntax after BGGA version 0.1
http://www.javac.info/closures-v01.html .

Cheers,
Neal


More information about the lambda-dev mailing list