Reuse 'do' keyword instead of hash sign (#)
Brian Goetz
brian.goetz at oracle.com
Mon Jun 20 10:24:39 PDT 2011
Already considered!
Some problems:
- It is already an identifier (meaning it suffers to some degree from
the "new keyword" problem);
- Most of the world doesn't know how to type it;
- The name "lambda" doesn't mean anything to most developers, only to
computer scientists. So it won't look any less random that # or ^ or
%#@($@(#$*, just harder to type.
That said, if IDEs wanted to offer the option to *display* it as λ
instead of # or whatever other syntax is chosen, I'm all for that.
On 6/20/2011 12:56 PM, Andrew Haley wrote:
> On 06/20/2011 04:52 PM, David Goodenough wrote:
>> Maybe if you want a keyword, use "lambda".
>>
>> So your i.e's below:-
>>
>> lambda()(5)
>> lambda(){return 5;}
>> lambda(int x,int y) { if (x>y) return x; else return y; }
>> button.onClick(lambda(Event e) { println("button clicked"); });
>>
>> This is not to say that we should use a keyword, rather a suggestion
>> if a keyword is to be used what it might be.
>>
>> This is offered in the "calling a spade a spade" tradition.
>
> So, why not "λ" ? :-)
> Java allows non-Latin characters in sources, surely...
>
> Andrew.
>
More information about the lambda-dev
mailing list