Coercing 'this' (was: Topic list - pending changes and issues for the ES3.1 spec)

Mark S. Miller erights at
Mon Sep 15 20:29:22 PDT 2008

On Mon, Sep 15, 2008 at 8:05 PM, Maciej Stachowiak <mjs at> wrote:

> On Sep 15, 2008, at 7:51 PM, Mark S. Miller wrote:
> On Mon, Sep 15, 2008 at 6:16 PM, Brendan Eich <brendan at> wrote:
>> On Sep 16, 2008, at 1:54 AM, Mark S. Miller wrote:
>> This is also badly incompatible. Global functions are used as methods of
>>> their window objects. Calling them via this.func() or otherFrame.func()
>>> works, but so do calls to func() from the same window.
>> Since there's only one window per JS global object (obviously, since
>> they're the same object), all the methods of the window could already be
>> bound to their window,
>> You're proposing to bind |this| to all window functions in strict mode?
> Worse. Since strict mode is only per program-unit, not per global object
> (frame), it makes no sense for such binding to be specific to strict mode.
> Rather, I'm proposing/asking whether it would be noticeably incompatible if
> all browser-provided window functions were bound to their window, period.
> Note that this need not be implemented or specified in terms of a specific
> 'bind' operation. It suffices to define all the browser-provided widow
> functions to refer to their window as 'window' rather than as 'this'.
> That would not be compatible with current Safari/WebKit behavior, and it
> may be a compatibility risk. I think anyone proposing this change should do
> research to determine the scope of the risk, and our default position should
> be "no compatibility-breaking changes until proven relatively safe".

Agreed. Probing such questions on this list is an economical first step in
any such research. I withdraw the suggestion, seeing as how it is outside
the jurisdiction of ES anyway.

-------------- next part --------------
An HTML attachment was scrubbed...

More information about the Es-discuss mailing list