-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
Normative: Remove [[VarNames]] from the global #3226
base: main
Are you sure you want to change the base?
Conversation
@syg This is a totally awesome proposal! Would love to implement. |
To be clear, the only observable change here is that if you have something like <script>
eval('var x;')
</script>
<script>
let x;
</script> that is current an error (per spec), and with this PR it would not be? |
Re: #3226 (comment) Yep, that's the intention. Same for <script>
eval('function x() {}')
</script>
<script>
let x;
</script> Edit: Another importance difference is also that you shadow the binding. So in the function example above, This may be an unintuitive and undesirable result, but my feeling with that is, as with many things, "just don't do that". |
At the February 2024 TC39 it was decided that this PR be moved into its own proposal (which I will do after plenary). |
Implemented in WebKit/WebKit#30121. |
The upshot of this change is that global var bindings introduced by sloppy direct eval becomes redeclarable by lexical bindings.
36c0034
to
e43f65f
Compare
Rebased. |
jmdyck points out that this undefines |
I noticed this due to a recent test262 test from @shvaikalesh: tc39/test262#3914
The explainer has been pulled into a proposal repo: https://github.com/tc39-transfer/proposal-redeclarable-global-eval-vars
This PR still serves as the spec draft.