Project Lambda: Java Language Specification draft
Alex Buckley
Alex.Buckley at Sun.COM
Fri Jan 22 16:18:20 PST 2010
// Don't forget to cc the list when replying!
Lawrence Kesteloot wrote:
>> #() { if (..) return "1"; else return 2; } has type #Integer()
>
> Is the string "1" really assignable to Integer? Did you mean #Object()?
Oops, yes!
>> LambdaInvocation:
>> '!' '(' ArgumentList_opt ')'
>> '.' '(' ArgumentList_opt ')'
>
> I didn't see any discussion or examples of the period invocation
> syntax. Is it identical to the exclamation mark? If you're saying that
> you haven't yet made up your mind as to which to use, then I vote for
> the period. I initially preferred the exclamation mark, but now I
> think I would consider this:
>
> adder.(5);
>
> to mean that the object "adder" has a field called "(" (i.e.,
> function) which I'm invoking here. It reminds the programmer that
> "adder" is an object, not a method. Also the exclamation mark looks
> like I'm being yelled at:
>
> adder!(5);
>
> And it's visually busier.
Surely it's the machine getting yelled at - "Apply an argument to adder,
now!" :-)
I meant to write in the cover note for the draft that many questions
about this project have no single right answer, yet pragmatism demands
we find one. Dot versus bang for lambda invocation is one such question.
Initially I just had bang (Am I the only one who also knows it as
pling?) but heard indirectly that Tim Peierls liked dot. At this stage I
see no harm in including both; I have not made up my mind.
Alex
More information about the lambda-dev
mailing list