A syntax option (function types versus arrays)
Gernot Neppert
mcnepp02 at googlemail.com
Thu Mar 11 00:56:48 PST 2010
2010/3/11 Howard Lovatt <howard.lovatt at gmail.com>:
> Yes, that is also a good suggestion, I have no real preference between the
> two forms. Note the round brackets around the arguments replace commas, so
> they are not really surpurfolous.
>
Yes, I know. Of course your proposal is totally consistent in its own right.
I just found the approach a bit 'hybrid': it surrounds the expression
deonoting the lambda's types within angular brackets, but then
introduces a different style for this expression, using round brackets
for the arguments.
Note that with your proposal the signature for a 'Runnable-like' lambda becomes:
lambda<void()> runnable = new lambda<void()> {
System.out.println("Hello world!"); };
which, to my eyes, looks arguably less elegant than the equivalent
with my proposal:
lambda<void> runnable = new lambda<void> { System.out.println("Hello
world!"); };
Simply because the first type variable denotes the return type 'void',
having no need for the empty parentheses.
More information about the lambda-dev
mailing list