Normative: Remove [[VarNames]] from the global#3226
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. |
36c0034 to
e43f65f
Compare
|
Rebased. |
|
jmdyck points out that this undefines |
The upshot of this change is that global var bindings introduced by sloppy direct eval becomes redeclarable by lexical bindings.
e43f65f to
ed75310
Compare
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.