W3C home > Mailing lists > Public > public-script-coord@w3.org > January to March 2015

Re: Global method calls

From: Boris Zbarsky <bzbarsky@mit.edu>
Date: Sun, 22 Feb 2015 20:48:24 -0500
Message-ID: <54EA86E8.40905@mit.edu>
To: es-discuss@mozilla.org, "public-script-coord@w3.org" <public-script-coord@w3.org>
On 2/22/15 4:55 PM, Domenic Denicola wrote:
> [1] indicates a plan to make [Global]-annotated objects, like the Window object, apply "[ImplicitThis] behavior" to the object's methods and the methods of anything that shows up in its prototype chain.

More like a proposal than a plan, sadly.  One that got no response.

> However, the plan at [1] seems to be only half-executed, in that Window defined at [3] does not have [ImplicitThis], but the definition of [PrimaryGlobal] and [Global] at [4] does not imply [ImplicitThis] behavior.

Right, so...

I think the [ImplicitThis] thing is silly, because it requires anyone 
creating any mixin that will got on the window to remember to use it. 
It also requires adding [ImpliciThis] to Window and EventTarget, but 
even this low bar hasn't been cleared, obviously.

> If I am indeed reading the situation correctly, I think the spec-level fix is to either implement the plan in [1], or to put [ImplicitThis] (back?) on the globals *and* on EventTarget.

And on every single thing that gets mixed into Window, afaict, though 
maybe we could wordsmith the bits around what [ImplicitThis] does such 
that it automatically applies to things pulled in via "implements"...

We'd also need it on all the worker global interfaces, right?  And any 
other kinds of globals with nontrivial proto chains that anyone creates. 
  Or do we want different behavior in workers?

If we do want this behavior in all Web IDL globals, we could just 
declare that all Web IDL methods are automatically [ImplicitThis], like 
I said in 
https://lists.w3.org/Archives/Public/public-script-coord/2013JulSep/0657.html

> I actually prefer the latter, since the way in which tagging [Window] as a [Global] implicitly makes EventTarget, defined in another spec, take on [ImplicitThis] behavior, seems hard to follow.

I agree that this is rather annoying.

-Boris
Received on Monday, 23 February 2015 01:48:55 UTC

This archive was generated by hypermail 2.3.1 : Monday, 23 February 2015 01:48:55 UTC