reuse 'do' keyword instead of hash sign (#)

Collin Fagan collin.fagan at gmail.com
Mon Aug 23 11:31:55 PDT 2010


Welcome Marcin,

It has been requested that syntax discussions be put to the side for the
time being in favor of spending more time using the prototype and giving
more targeted feedback to the developers (who seem to be working long hours
and on weekends). The participants on the list are divided about a number of
issues, syntax being just one. I assume at some point this restriction will
be lifted but I'm not sure as I'm not an Oracle employee.

Collin

2010/8/22 Marcin Wiśnicki <mwisnicki at gmail.com>

> Would it be possible to change the clumsy '#' operator to 'do' keyword ?
> I.e.:
>
>  do()(5)
>  do(){return 5;}
>  do(int x, int y) { if (x>y) return x; else return y; }
>  button.onClick(do(Event e) { println("button clicked"); });
>
> I find it more readable, OTOH using special characters feels a bit
> like perl (noisy), especially when combining multiple lambdas.
> It event makes sense if you parse it as english.
>
> Don't know what to do with anonymous function type but it could remain as
> '#'.
>
> Pros:
>  - more readable
>  - makes sense
>  - like '#' needs only 1-lookahead to disambiguate from do-while '(' vs '{'
> [1]
>  - did I mention it's more readable ?
>
> Cons:
>  - none (that I could think of)
>
> [1] Automatic Resource Management from Coins wanted to use 'do' but I
> see they have switched to 'try' so no problem there.
>
> PS. Please CC me since I'm not subscribed, thanks.
>
>


More information about the lambda-dev mailing list