A (perhaps) useful thing to keep in mind.
On Nov 22, 2011, at 8:21 AM, Jorge wrote:
It seems that all of these are equally valid ways to say "function ƒ () { ... }" :
function ƒ () { ... } function ƒ () {{ ... }}
Actually these can have slightly different static semantics in ES.next
function f(arg) { let arg = 42; //early error duplicate declaration of 'arg }
function f(arg) {{ let arg = 42; //block level declaration of 'arg' shadows formal parameter }}
On Nov 22, 2011, at 8:21 AM, Jorge wrote:
It seems that all of these are equally valid ways to say "function ƒ () { ... }" :
function ƒ () { ... } function ƒ () {{ ... }} function ƒ () {{{ ... }}} .. etc.
I think that perhaps it can be used cleverly to hack something useful. For example, a generator instead an asterisk, might require two braces. Or whatever. Just saying.
No, we want a breaking syntactic change for generators, even empty ones (no 'yield' -- also, yield could be written to look like a function call). We do not want existing code that for whatever reason (accidentally, even) doubled function body braces to suffer a shift of meaning. That's a runtime-incompatible change. We're keeping five fingers of fate for those:
- Lexical scope at top level (no window property aliasing from global vars).
- typeof null == "null". 3-5. reserved, I hope not to use any more.
It seems that all of these are equally valid ways to say "function ƒ () { ... }" :
function ƒ () { ... } function ƒ () {{ ... }} function ƒ () {{{ ... }}} .. etc.
I think that perhaps it can be used cleverly to hack something useful. For example, a generator instead an asterisk, might require two braces. Or whatever. Just saying.
My 0.02