Putting `global` reference in specs

Calvin Metcalf calvin.metcalf at gmail.com
Fri Apr 17 18:40:36 UTC 2015


This came up in iojs, did not go over well.
https://github.com/iojs/io.js/issues/1043

On Fri, Apr 17, 2015 at 1: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
> _______________________________________________
> 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/d0508e49/attachment.html>


More information about the es-discuss mailing list