Expression closures - use-cases for shortcut lambda syntax (blocks)

Brendan Eich brendan at mozilla.org
Fri Mar 16 01:58:18 PDT 2007


Ok, this is getting out of hand ;-).

Seriously, we are not going to inject any alien syntax. Vassily  
proposed a shorthand in expression closures: \ for function. Let's  
try to get back to that.

On Mar 16, 2007, at 1:49 AM, Daniel C. Wang wrote:

> why not
> {(x,y) \  x + y }
> then it would be
> ajax(url, { (response)  \
>                    // do something });
>
> ... you can then consider introducing
>
> { (x,y) |   x % 2 == y}


That's ambiguous: , | % and == are all dyadic operators.

> which just constrains the body to be a predicated!

This isn't a comprehension. Not sure why the syntax constrains the  
expression to be boolean.

/be




More information about the Es4-discuss mailing list