Andrey (azangru) wrote,
Andrey
azangru

I remember a TC39 proposal, from several years ago, to introduce the common name for the global namespace object, which is referred to as window in the browser, and global in Node. The proposal was to uniformly call it global.

I haven't been following this proposal, and today I learnt that the proposal has been given a go-ahead, but the name has been changed from "global" to "globalThis". The reason — introducing the keyword "global" into the language broke Flickr, which was using it for some bundling purposes; and probably some other sites as well.

I don't have any particular feelings about the globalThis, but this episode reminded me of the recent dropping of array method name "flatten" in favor of "flat", because an ancient library called MooTools was monkey-patching the Array prototype adding its own "flatten" method to it, and it had a different type signature. That decision I minded a lot. MooTools have already gone into oblivion, while whatever enters the language stays; and to be influenced by bad decisions of old libraries while evolving the language is irresponsible. A method name should be a verb. Flatten is a verb; flat is not.
Subscribe

  • (no subject)

    "This session has been cancelled..."

  • (no subject)

    Sanjay Gupta: "Even if you've already had covid, you still need to get vaccinated" Is this the party line now? Not "if you've already had covid,…

  • (no subject)

    Someone has montaged together short clips from a Labour party conference held in 2019. Boris Johnson hadn't yet won the election, and Brexit was…

  • Post a new comment

    Error

    default userpic
    When you submit the form an invisible reCAPTCHA check will be performed.
    You must follow the Privacy Policy and Google Terms of use.
  • 7 comments