The global object as the "global scope instance object"

Andreas Rossberg rossberg at google.com
Mon Jan 23 10:15:46 PST 2012


On 23 January 2012 18:39, Brendan Eich <brendan at mozilla.org> wrote:
>Andreas Rossberg <mailto:rossberg at google.com>
>> In other words, the current behaviour breaks both scoping and objects
>> semantics.
>
> Non-strict or really pre-strict implementations broke scoping semantics --
> no temporal dead zone. Whether we can retroactively force the new semantics
> on any JS that worked with the old scoping semantics remains to be seen.
>
> Object semantics, I think you misread the alert output. Or did I?

Big oops, you are right. How embarrassing! I apologize to Gavin for
misrepresenting!

The scoping issue remains, though. Existing implementations are
seriously broken there. For example, for some compatibility reasons,
V8 currently allows

  var w = 1; w = 2; print(w); const w = 3

which will output 2. The idea most likely was that const should behave
like var. This, and other, similar examples clearly have to break if
should const become official in classic mode, so the compatibility
argument may not carry far.

> This is future-hostile to guards, or really, we kick the can down the road a
> bit and evangelize strict mode. If and when we add guards, we can either
> break scoping semantics backward compatibility, or require strict opt in.

Doesn't sound pleasant to me... :(

/Andreas


More information about the es-discuss mailing list