A (perhaps) useful thing to keep in mind.

# Jorge (14 years ago)

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

# Allen Wirfs-Brock (14 years ago)

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 }}

# Brendan Eich (14 years ago)

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:

  1. Lexical scope at top level (no window property aliasing from global vars).
  2. typeof null == "null". 3-5. reserved, I hope not to use any more.