-
Notifications
You must be signed in to change notification settings - Fork 67
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
thisValue vs global #217
Comments
Or have only one getter called “globalThis”, to make it clear what value it’s returning? |
I'm ok with the simplification, considering that the parameterized evaluator will allow you to control access to the In the realm's proposal, the only reason why I will bring this up in the next SES meeting, and carry on the changes if we get to some agreement there. |
Where's the current best reference for parameterized evaluators? I can see https://github.com/tc39/proposal-ses#the-compartment-constructor but I don't see where the hooks are defined. |
You found the right place. The hooks will be in the options bag of the Compartment constructor. At https://github.com/tc39/proposal-ses/blob/master/refactor-spec-approach.md#random-notes we've been gathering the things in the spec that look like they might be host hooks. We did some old work back before we split realms from ses to pin down what the API should be for hooking these. We have yet to revisit and update that work. Do you know of any host hooks or host-provided intervention in JS behavior that we didn't capture in that list? |
FYI, in issue #210, @Jamesernator listed what seems to be a very comprehensive list. |
Another issue that I've observed is that if only the thisValue is used, you end up with values that are reachable via |
@devsnek can you elaborate more? I'm confused by your comment. I think @ljharb suggestion is that we only have one getter |
(One of my takeaways here: calling it |
To clarify, with the current Realm API you can't implement the WindowProxy semantics. My hope is that this is the kind of things that you can do in the evaluator where you can have a hook to mimic access to the global object and this value. |
The purpose wasn’t to make WindowProxy semantics clear to those who didn’t already understand them, for the record, it was because those who do objected to any implication that it was the global object. |
I see that there are two separate getters,
global
andthisValue
. I wonder if this relates to how HTML has aWindowProxy
. In HTML, only the "this value" is ever exposed, and the underlying "global" is never exposed. I think there's only one concept that makes sense for actual JS programmers. We could call it either theglobal
or thethisValue
(I preferglobal
), but I'm skeptical that we should have two getters potentially returning different things. I'd suggest simply removing thethisValue
getter.The text was updated successfully, but these errors were encountered: