Block lambda is cool, its syntax isn't

Herby Vojčík herby at mailbox.sk
Thu Jan 19 11:40:50 PST 2012


Brendan Eich wrote:
> Axel Rauschmayer <mailto:axel at rauschma.de>
> January 19, 2012 9:31 AM
>
> Rationale: wouldn’t freezing by default be OK for 98% of the cases? If
> you want anything else, you can use a traditional function. Then the
> above syntax as the only function shorthand would be OK.
>
>
> First, #(params) { body } was proposed by Arv and Alex:
>
> http://wiki.ecmascript.org/doku.php?id=strawman:shorter_function_syntax
>
> Arv and Alex feel strongly that the shorter function syntax (anything
> shortening 'function' syntax) must not freeze by default.

Well, if #(x, y) {x+y} is not good because of # is used for freezing and 
freezing is not good (it is not, metadata is good argument for that), 
and if something-like-lambda-block is ok, some variation of lambda-block 
could be the shorter replacement for functions. These come to mind:

   {*a, b* a+b}
   {/a, b/ a+b}
   {^a, b^ a+b}
   {%a, b% a+b}

and there is still more infix operators...

maybe even {`a, b` a+b} if it does not create conflict in this context.

> /be

Herby


More information about the es-discuss mailing list