Dmitry Soshnikov wrote:
FOO = 45;

bar(); // 48

Use cases like:

function bar(y = FOO + 3) {
  var FOO = 10;
  return y;
}

May look subtle, however, if again to accept lexical scope as the function definition, then FOO again should be resolved in the bar.[[Scope]], not in the bar's activation:

bar(); // still 48

It's a good point. The ES6 proposal is more expressive than Python and subsumes it. You can compose:

  var FOO = 42;
  function bar(x, y = FOO + x) {...}

and use both activation-scope parameters and outer-scope closed-over variables as usual.

/be
_______________________________________________
es-discuss mailing list
[email protected]
https://mail.mozilla.org/listinfo/es-discuss

Reply via email to