> Well, the thing that globalThis returns is NOT the global object, and
telling people that it is will just confuse them when it behaves in a
way they don't expect.

Hello Boris, thanks for your opinion and thoughts!

That's the thing: the only people that may get confused are Ecmascript
and JS-Engine experts who know the internals very intimately. I've
been making web applications for a long time, and have never had to
think about the concept that you've described. I continue to believe
that *the vast majority* of web developers would never get confused,
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), and in the first case they actually won't be
confused because they are familiar with engine internals, and in the
second case browsers need to not create bugs like that.

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.
It's as simple as that 99.999999% of the time.

I strongly believe that things should be made intuitive for the vast
majority of users, not the very few experts who know enough not to be
confused, or the very few people hitting a browser bug that should in
all honesty be patched in effort to make things easy for end
developers.

All the best,
- Joe

On Mon, Oct 7, 2019 at 1:11 PM Boris Zbarsky <bzbar...@mit.edu> wrote:
>
> On 10/7/19 1:56 PM, #!/JoePea wrote:
> > Who's going to write code like that anyways?
>
> In the general form of "function from a navigated-away-from document
> runs because it's called by some script from outside the document", I've
> seen this come up a number of times in web browser bug reports.
>
> > Everyone's moving to ES modules, where `this` for accessing the global
> > is just `undefined`.
>
> It's not just "this".  The same thing applies to "window", "self", etc,
> etc.  There is no way to actually get your hands on the global object
> explicitly in a DOM Window scope: you always get the WindowProxy instead.
>
> > It's highly unlikely that any concept other than
> > "global object" will ever be conceived by the vast majority of users,
> > especially future users.
>
> Well, the thing that globalThis returns is NOT the global object, and
> telling people that it is will just confuse them when it behaves in a
> way they don't expect.
>
> -Boris
_______________________________________________
es-discuss mailing list
es-discuss@mozilla.org
https://mail.mozilla.org/listinfo/es-discuss

Reply via email to