Putting `global` reference in specs

Andrea Giammarchi andrea.giammarchi at gmail.com
Fri Apr 17 17:19:01 UTC 2015


> As such I think our best bet is for server-side JS runtimes to use `self`
or `window`.

I personally hope that would never happen, and you managed to over-engineer
the simplest alignment requirement I could possibly think of ... indeed ...



> We might as well move it into the set of terms like "realm" or "vat" or
"environment" that are more abstract than real.

a new term like realm will just create more fragmentation =>
https://xkcd.com/927/ + there's no such thing on server side, at least not
the same there is on front end

vat is at least semantic in this case since it means Value-Added Tax ...
but I am back to previous point

environment is confusing with `process.env`



Let's avoid the introduction of more problems please ... I rather leave
things as it is since we are unable to be pragmatic, no matter how straight
forward is the solution.


On Fri, Apr 17, 2015 at 6:11 PM, Domenic Denicola <d at domenic.me> wrote:

> One thing I'm surprised nobody has brought up yet is that "global" would
> be an incorrect name in the case of browsers. The actual global object is
> not (and must never be) directly accessible. Instead you get a window proxy
> when you use `window`, `self`, `this`, etc.
>
> As such I think our best bet is for server-side JS runtimes to use `self`
> or `window`.
>
> The latter isn't as crazy as it sounds: just start adding phrases to the
> ES spec like "all JavaScript code runs within a certain context, called a
> _window_, which has a corresponding _window object_. In some runtimes the
> window object will be equivalent to the global object, but not always.
> Scripts run within _window scope_, whereas modules run in their own lexical
> context. The value of **this** in window scope is the window object."
>
> It's not as if `window` actually means "window" anymore, given tabs and
> iframes and frames. We might as well move it into the set of terms like
> "realm" or "vat" or "environment" that are more abstract than real.
>
> -----Original Message-----
> From: es-discuss [mailto:es-discuss-bounces at mozilla.org] On Behalf Of
> Anne van Kesteren
> Sent: Friday, April 17, 2015 11:19
> To: Andrea Giammarchi
> Cc: es-discuss at mozilla.org
> Subject: Re: Putting `global` reference in specs
>
> On Fri, Apr 17, 2015 at 5:12 PM, Andrea Giammarchi <
> andrea.giammarchi at gmail.com> wrote:
> > So I'd say we should not have `self` (if stays on global and Worker I
> > don't actually care) and add a `global` that nobody needs explanation
> > to understand what it is in JavaScript
>
> Indeed, three ways to reference the global object is not nearly enough.
>
>
> --
> https://annevankesteren.nl/
> _______________________________________________
> es-discuss mailing list
> es-discuss at mozilla.org
> https://mail.mozilla.org/listinfo/es-discuss
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20150417/644a9174/attachment.html>


More information about the es-discuss mailing list