default this binding for ES-next strict mode.

Jake Verbaten raynos2 at
Fri Nov 18 13:51:24 PST 2011

On Fri, Nov 18, 2011 at 9:30 PM, Axel Rauschmayer <axel at> wrote:

> > What if we changed the value of `this` inside local function
> declarations to be the value of this in the outer function.
> I’d love this to work!
> Alas, the value of `this` has to be determined dynamically. Mark Miller
> gave a good example why that’s bad (when I recently suggested the same
> thing):

I don't think that's neccessarily a bad thing. If you ask me, it's a poor
counter example because innerPoint should not be defined inside Outer.

I defiantly see the problem with the value of `this` leaking through any
closures you return. I'm not sure whether this is particularly bad. It's
just something people need to be aware of.

Of course this adds two more cons

 - outer value of `this` leaks through returned closures
 - code that used to throw an error, will now work with unexpected side
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>

More information about the es-discuss mailing list