Putting `global` reference in specs

Mark S. Miller erights at google.com
Fri Apr 17 16:04:19 UTC 2015


Which would have made virtualization without translation impossible. Glad
we dodged that bullet ;).


On Fri, Apr 17, 2015 at 9:00 AM, Mameri, Fred (HBO) <Fred.Mameri at hbo.com>
wrote:

>  At some point in the past, I proposed that we introduce syntax for that.
> In my proposal, prefixing an identifier with a "." would create an
> unambiguous reference to the global version of that variable.
>
>  For example:
> ```js
> var x;
> function f(x) {
>    x; // local
>    .x; // global
> }
> ```
>
>  This is an idea I borrowed from C++’s :: operator.
>
>   From: Mark Miller <erights at gmail.com>
> Date: Friday, April 17, 2015 at 8:53 AM
> To: Glen Huang <curvedmark at gmail.com>
> Cc: "Mark S. Miller" <erights at google.com>, "es-discuss at mozilla.org" <
> es-discuss at mozilla.org>
> Subject: Re: Putting `global` reference in specs
>
>   This is one of several cases where, post ES6, we can provide a std
> module import that provides a built-in that carries authority. Another
> example is the constructor for making weak references, which necessarily
> provide the ability to read a covert channel. As with shadowable globals,
> this module import must be easy to virtualize. We purposely postponed this
> along with the Loader and Realm API as it is security sensitive and we
> don't yet have enough usage experience with modules to know how to design
> this separation well.
>
>  In particular, we rejected the obvious Reflect.global as it bundles the
> global together with authority-free safe things, which makes virtualization
> of the global alone needlessly unpleasant.
>
>
>
> On Fri, Apr 17, 2015 at 8:45 AM, Glen Huang <curvedmark at gmail.com> wrote:
>
>> You guys are talking about referencing the global object in modules
>> right? Since in scripts you can reliably get hold of the global object by
>> using "this" in the root scope.
>>
>>  And es 2015 made an explicit choice to clobber "this" in the root scope
>> of a module, I guess that means module code really isn't supposed to get
>> hold of the global object?
>>
>>  On Apr 17, 2015, at 11:34 PM, Mark S. Miller <erights at google.com> wrote:
>>
>>  I almost omitted it, but one should never need to encounter or think
>> about sloppy code unless absolutely necessary. For my brain, adding the
>> "use strict"; makes this snippet of code much simpler.
>>
>>
>> On Fri, Apr 17, 2015 at 8:30 AM, Andreas Rossberg <rossberg at google.com>
>> wrote:
>>
>>>  On 17 April 2015 at 17:27, Mark S. Miller <erights at google.com> wrote:
>>>
>>>> (1,eval)('"use strict"; this')
>>>>
>>>
>>>  Is the 'use strict' relevant here? Seems overkill.
>>>
>>>  /Andreas
>>>
>>>
>>>
>>>>
>>>>  On Fri, Apr 17, 2015 at 8:23 AM, Andrea Giammarchi <
>>>> andrea.giammarchi at gmail.com> wrote:
>>>>
>>>>>  there's actually no way, officially, to reference what ES2015 call
>>>>> *the global object*, just pointless fragmentation between engines.
>>>>>
>>>>>
>>>>>
>>>>> On Fri, Apr 17, 2015 at 4:19 PM, Anne van Kesteren <annevk at annevk.nl>
>>>>> wrote:
>>>>>
>>>>>> 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
>>>>>
>>>>>
>>>>
>>>>
>>>>  --
>>>>     Cheers,
>>>>     --MarkM
>>>>
>>>> _______________________________________________
>>>> es-discuss mailing list
>>>> es-discuss at mozilla.org
>>>> https://mail.mozilla.org/listinfo/es-discuss
>>>>
>>>>
>>>
>>
>>
>>  --
>>     Cheers,
>>     --MarkM
>>  _______________________________________________
>> 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
>>
>>
>
>
>  --
> Text by me above is hereby placed in the public domain
>
>   Cheers,
>   --MarkM
>
> ---------------------------------------------------------------------
> This e-mail is intended only for the use of the addressees. Any copying,
> forwarding, printing or other use of this e-mail by persons other than the
> addressees is not authorized. This e-mail may contain information that is
> privileged, confidential and exempt from disclosure. If you are not the
> intended recipient, please notify us immediately by return e-mail
> (including the original message in your reply) and then delete and discard
> all copies of the e-mail.
>
> Thank you.
>
> ---------------------------------------------------------------------
>



-- 
    Cheers,
    --MarkM
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20150417/579eb88f/attachment.html>


More information about the es-discuss mailing list