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)

    A software engineer: This format [of reading binary numbers] is known as -endian, which I always thought is a funny name. No-one says that…

  • (no subject)

    Brilliant!

  • (no subject)

    O M G 🤦

  • 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