On Mon, May 2, 2011 at 5:50 PM, Allen Wirfs-Brock <[email protected]>wrote:
> According to the spec. it should alert the global object:
> The reference to foo resolves to a Reference to an object environment
> record. When getValue is called on that reference it goes through step 5.a
> and calls GetBindingValue on the env record. GetBindingValue does a [[Get]]
> on the global object. [[Get]] internally retrieves an accessor property and
> does a call to the [[Get]] function passing the global objet as the this
> value.
>
It's not the answer I was hoping for, but on reexamination I see that you're
correct. Thanks.
>
> Allen
>
>
> On May 2, 2011, at 4:43 PM, Mark S. Miller wrote:
>
> > According to the ES5 spec, should the following program alert the global
> object or undefined? Why?
> >
> > Object.defineProperty(this, 'foo', {get:function(){"use strict";
> return this;}});
> > alert((function(){"use strict"; return foo;})());
> >
> >
> > --
> > Cheers,
> > --MarkM
> > _______________________________________________
> > es5-discuss mailing list
> > [email protected]
> > https://mail.mozilla.org/listinfo/es5-discuss
>
>
--
Cheers,
--MarkM
_______________________________________________
es-discuss mailing list
[email protected]
https://mail.mozilla.org/listinfo/es-discuss