Skip to content

How to handle the top level of scripts? #14

Description

@bakkot

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?

  1. Just like let/const, shared across all scripts on the page
  2. Scoped just to that script
  3. 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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions