Block lambda grammar: BlockArguments

Brendan Eich brendan at mozilla.org
Mon Jan 16 08:50:26 PST 2012


> Lasse Reichstein <mailto:reichsteinatwork at gmail.com>
> January 16, 2012 5:54 AM
>
> I believe it's perfectly valid to write blocks (for no particular
> reason) without any keyword.
> I.e.:
> function foo() {
>   var x = 42;
>   {
>     var y = 10;
>     print(x+y);
>   }
>   return x;
> }
>
> Obviously it's useless, but it is valid.

It becomes useful with the introduction of 'let', 'const', and ES.next 
'function' in block declarations.

> You could add a label to the block if you want to actually use it for 
> something:
>
> bar: {
> if (x == 10) { y = 10; break bar; }
> if (x == 20) { y = 0; break bar; }
> ...
> }
>
> /L 'Bad examples are bad!'

;-)

/be
> _______________________________________________
> es-discuss mailing list
> es-discuss at mozilla.org
> https://mail.mozilla.org/listinfo/es-discuss
> Brendan Eich <mailto:brendan at mozilla.org>
> January 15, 2012 11:41 PM
>> Herby Vojčík <mailto:herby at mailbox.sk>
>> January 15, 2012 1:24 AM
>>
>> "Nothing is going to match Smalltalk on this. Keyword parameters are 
>> not even on the map because object literals suck the oxygen out of 
>> the room. And then you'll want to get rid of the || for empty block 
>> parameters."
>> ===
>>
>> Sorry for this question, it is more a meta one. The paragraph above 
>> seems too dense for me to digest (and I thought my English is pretty 
>> good). Would it be possible to explain a little more? Like what is 
>> meant by "going to match"
>
> "be as good as" Smalltalk.
>
>> and what is "this" in "on this; 
>
> "on keyword selector syntax".
>
>> and things like "not in the map"
>
> No strawman or even idle chatter about adding keyword parameter 
> passing to JS.
>
>> , "o.l. suck the oxygen out of the room", and the last sentence, too.
>
> We have discussed here and in TC39 how {key: val} actual parameters in 
> the language already (object literals) remove most of the 
> justification and almost all motivation for adding key: val parameter 
> syntax to call expressions.
>>
>> Thank you, Herby
>
> Hope this helps.
>>
>> [ did you know you quoted cca 50 screens? 8-O I took the liberty of 
>> omitting them. ]
>
> I'm using a new mail user agent and it does tend to overcite. Sorry, 
> will try to fix.
>
> /be
> Herby Vojčík <mailto:herby at mailbox.sk>
> January 15, 2012 1:24 AM
>
>
> -----Pôvodná správa----- From: Brendan Eich
> Sent: Sunday, January 15, 2012 7:55 AM
> To: Axel Rauschmayer
> Cc: es-discuss
> Subject: Re: Block lambda grammar: BlockArguments
>
> Nothing is going to match Smalltalk on this. Keyword parameters are 
> not even on the map because object literals suck the oxygen out of the 
> room. And then you'll want to get rid of the || for empty block 
> parameters.
> ===
>
> Sorry for this question, it is more a meta one. The paragraph above 
> seems too dense for me to digest (and I thought my English is pretty 
> good). Would it be possible to explain a little more? Like what is 
> meant by "going to match" and what is "this" in "on this; and things 
> like "not in the map", "o.l. suck the oxygen out of the room", and the 
> last sentence, too.
>
> Thank you, Herby
>
> [ did you know you quoted cca 50 screens? 8-O I took the liberty of 
> omitting them. ]
> _______________________________________________
> es-discuss mailing list
> es-discuss at mozilla.org
> https://mail.mozilla.org/listinfo/es-discuss
> Brendan Eich <mailto:brendan at mozilla.org>
> January 14, 2012 10:55 PM
> Nothing is going to match Smalltalk on this. Keyword parameters are 
> not even on the map because object literals suck the oxygen out of the 
> room. And then you'll want to get rid of the || for empty block 
> parameters.
>
> I say pause with a simpler design and digest, ruminate, prototype, 
> user-test.
>
> /be
>
> Axel Rauschmayer <mailto:axel at rauschma.de>
> January 14, 2012 9:35 PM
> Cool. I also have a feeling that every paren-free lambda after the 
> first one should have some kind of preceding keyword or name, but I 
> don’t know how one could make that happen. Brace-free object literals? 
> (only half joking)
>
> On Jan 15, 2012, at 3:42 , Brendan Eich wrote:
>
> -- 
> Dr. Axel Rauschmayer
> axel at rauschma.de <mailto:axel at rauschma.de>
>
> home: rauschma.de <http://rauschma.de>
> twitter: twitter.com/rauschma <http://twitter.com/rauschma>
> blog: 2ality.com <http://2ality.com>
>
> _______________________________________________
> 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/20120116/470fdd58/attachment-0001.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: compose-unknown-contact.jpg
Type: image/jpeg
Size: 770 bytes
Desc: not available
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20120116/470fdd58/attachment-0004.jpg>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: postbox-contact.jpg
Type: image/jpeg
Size: 1290 bytes
Desc: not available
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20120116/470fdd58/attachment-0005.jpg>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: postbox-contact.jpg
Type: image/jpeg
Size: 1080 bytes
Desc: not available
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20120116/470fdd58/attachment-0006.jpg>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: postbox-contact.jpg
Type: image/jpeg
Size: 1222 bytes
Desc: not available
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20120116/470fdd58/attachment-0007.jpg>


More information about the es-discuss mailing list