The top-level lexical scope of <script> elements is awkward: it is shared across all scripts on the page.
IIUC this was basically to make it easier to move from var to let, which, fine, whatever. No such justification applies here.
How should we handle private #x declarations at the top level of scripts?
- Just like
let/const, shared across all scripts on the page
- Scoped just to that script
- Banned
I really don't like 1 both for implementation reasons and because the whole point of these things is to have a restricted, easy-to-analyze scope where the name is usable. Either 2 or 3 is fine in my opinion.
The top-level lexical scope of
<script>elements is awkward: it is shared across all scripts on the page.IIUC this was basically to make it easier to move from
vartolet, which, fine, whatever. No such justification applies here.How should we handle
private #xdeclarations at the top level of scripts?let/const, shared across all scripts on the pageI really don't like 1 both for implementation reasons and because the whole point of these things is to have a restricted, easy-to-analyze scope where the name is usable. Either 2 or 3 is fine in my opinion.