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)

    Via Twitter. From the book The Gray Lady Winked, photographed by Michael Shermer: Here's the tweet that the paragraph references (took a while…

  • (no subject)

    To unscramble an egg, by the way, would be a closer idiomatic parallel to ungrinding ground meat, and in spite of Julia Ioffe, is just as dark, blunt…

  • (no subject)

    Thought of this phrase today for some reason, then thought whether it exists in English (putting toothpaste back into the tube came to mind), then…

  • 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