Block lambda is cool, its syntax isn't

Brendan Eich brendan at mozilla.org
Thu Jan 12 19:33:34 PST 2012


The correspondence principle is a big change for the body, so even if we 
could reserve block or abuse do, making the special form look like 
function (params) { body } is a mistake. 'return' does not return from 
the block, it returns from the enclosing function.

I'm not in love with Ruby syntax but {(a, b) a + b} isn't as distinctive 
and clearly a lambda-like thing. You're right about that, but turning 
back to function-based syntax with a different introductory keyword goes 
the wrong direction. This is why I keep coming back to "different syntax 
is a virtue". The correspondence-principle-based semantics are different 
enough.

/be

> Tab Atkins Jr. <mailto:jackalmage at gmail.com>
> January 12, 2012 5:44 PM
>
> I agree. While Ruby and Smalltalk are useful to continue mining for
> ideas, they shouldn't be a source of syntax, as they're not
> super-popular. Using || to denote an argument list looks *bizarre* to
> my eyes, and I suspect also to the eyes of every single person who's
> used a C-like language but not Ruby.
>
> I'm not wedded to {(a,b) a + b} for blocks either, but it's at least
> an improvement over {|a,b| a + b}. I wouldn't mind something simple
> like "block(a,b){a+b}" or even "do(a,b){a+b}", though those probably
> run into ambiguity issues.
>
> ~TJ
> _______________________________________________
> es-discuss mailing list
> es-discuss at mozilla.org
> https://mail.mozilla.org/listinfo/es-discuss
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20120112/03a7b6dc/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: postbox-contact.jpg
Type: image/jpeg
Size: 1021 bytes
Desc: not available
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20120112/03a7b6dc/attachment.jpg>


More information about the es-discuss mailing list