Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.
Sign up@@unscopables should not apply to the global environment record #245
Comments
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
Show comment
Hide comment
anba
Dec 11, 2015
Contributor
The "If the withEnvironment flag of envRec is false, return true." step handles this case. (withEnvironment is false for the object environment of the global environment.)
|
The "If the withEnvironment flag of envRec is false, return true." step handles this case. (withEnvironment is false for the object environment of the global environment.) |
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
Show comment
Hide comment
|
@anba, argh, you're right, how did I miss that! Sorry for the noise. |
rossberg
closed this
Dec 11, 2015
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
rossberg commentedDec 11, 2015
According to the current spec, the following program should produce
undefined:Of all 3 browsers that implement @@unscopables (Chrome, Edge, Safari), none seems to handle that. And there is a likely reason: it would be disastrous for performance, at least unless very complicated measures are taken in VMs. That's because every access to a conventional global variable
xwould require also looking upwindow[@@unscopables].x, i.e., two extra property look-ups. Worse, as a consequence, all existing (and essential) optimisations around global variable access are invalidated by this semantics.I'm not sure if this semantics was intended, or where it would be useful (@@unscopables was introduced for dealing with
withlegacy). But given the implications and the noteworthy failure of all browsers to implement it correctly, I propose removing @@unscopables filtering for the global environment.