Why globalThis instead of something intuitive like globalObject, systemGlobal, or globalEntity?

Boris Zbarsky bzbarsky at mit.edu
Sun Nov 17 19:52:53 UTC 2019


On 11/16/19 12:52 PM, #!/JoePea wrote:
> That's the thing: the only people that may get confused are Ecmascript
> and JS-Engine experts who know the internals very intimately.

No, it's just people who have functions return values they do not expect.

> and for those people that could possibly get confused, it would be
> because they are familiar with browser internals (or hit a browser
> *bug* like you describe)

No, you misunderstand.  The bug reports were filed because the behavior 
was not what people expected.  They were duly marked invalid, because 
the problem was with the expectations, not the behavior...

> For all intents and purpose, every developer I've talked to, and every
> article I've read, treats things like `window` as the global object.

And this is mostly fine as long as you don't call functions from 
navigated-away-from windows. Which most people don't, most of the time. 
And when they do, they get _very_ confused by the results, because 
reality does not match what they had been told.

But that doesn't mean we should double down on telling them things that 
don't match reality.

> I strongly believe that things should be made intuitive for the vast
> majority of users

I agree, but in this specific context, what does that mean in terms of 
concrete proposals you are making?

-Boris


More information about the es-discuss mailing list