New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

@@unscopables should not apply to the global environment record #245

Closed
rossberg opened this Issue Dec 11, 2015 · 2 comments

Comments

Projects
None yet
2 participants
@rossberg
Member

rossberg commented Dec 11, 2015

According to the current spec, the following program should produce undefined:

this[Symbol.unscopables] = {Object: true}
Object  // 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 x would require also looking up window[@@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 with legacy). But given the implications and the noteworthy failure of all browsers to implement it correctly, I propose removing @@unscopables filtering for the global environment.

@anba

This comment has been minimized.

Show comment
Hide comment
@anba

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.)

Contributor

anba commented Dec 11, 2015

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.)

@rossberg

This comment has been minimized.

Show comment
Hide comment
@rossberg

rossberg Dec 11, 2015

Member

@anba, argh, you're right, how did I miss that! Sorry for the noise.

Member

rossberg commented Dec 11, 2015

@anba, argh, you're right, how did I miss that! Sorry for the noise.

@rossberg rossberg closed this Dec 11, 2015

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment