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@mozilla.org
https://mail.mozilla.org/listinfo/es-discuss
January 15, 2012 11:41 PM
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
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@mozilla.org
https://mail.mozilla.org/listinfo/es-discuss
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

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


_______________________________________________
es-discuss mailing list
es-discuss@mozilla.org
https://mail.mozilla.org/listinfo/es-discuss
_______________________________________________
es-discuss mailing list
es-discuss@mozilla.org
https://mail.mozilla.org/listinfo/es-discuss

Reply via email to