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

#!/JoePea joe at trusktr.io
Fri Nov 22 17:44:25 UTC 2019


> Then why was you previous mail saying that browsers should fix it?

Because I believe they should, but I know they won't. :)

> It means "that thing that `this` would return in global scope".  No more,
no less.

And (maybe unfortunately) for many people that amounts to being equivalent
to "window". (I know it is wrong, but that's what many people think while
not knowing about window proxies).

On Thu, Nov 21, 2019 at 2:37 PM Boris Zbarsky <bzbarsky at mit.edu> wrote:

> On 11/21/19 5:21 PM, #!/JoePea wrote:
> >> They were duly marked invalid, because the problem was with the
> expectations, not the behavior...
> >
> > It's a design bug.
>
> Well, sure, if we're talking about the fact that there is no clear
> separation in the web platform's exposed objects between "a container
> that can be navigated" and "the thing currently loaded in that
> container"; both are represented, kinda weirdly, by "window".
>
> > I know, impossible to fix.
>
> Then why was you previous mail saying that browsers should fix it?
>
> > I'm not sure I even know what "globalThis" means now. :)
>
> It means "that thing that `this` would return in global scope".  No
> more, no less.
>
> In practice, in web pages, that thing is a WindowProxy object as defined
> at
>
> https://html.spec.whatwg.org/multipage/window-object.html#the-windowproxy-exotic-object
>
> -Boris
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20191122/ccc91fb5/attachment-0001.html>


More information about the es-discuss mailing list