Generator issue: exceptions while initializing arguments
Brendan Eich
brendan at mozilla.com
Tue Sep 11 01:39:31 PDT 2012
Brendan Eich wrote:
> Dmitry Soshnikov wrote:
>> var FOO = 42;
>> function bar(x, y = FOO + z) { var z = 10; } // Error .. ?
>
> Translating to JS as it is:
>
> var FOO = 42;
> function bar(x, y) {
> if (y === void 0) y = FOO + z;
> var z = 10;
> }
Another benefit of the simple semantics: existing JITs can optimize
easily, no new semantics to special-case. This is not a dominant concern
but it is a selling point from my experience dealing with (and playing
one on TV ;-)) implementors.
/be
More information about the es-discuss
mailing list