W3C home > Mailing lists > Public > public-script-coord@w3.org > October to December 2014

Re: Determining what prototype should be used for an object

From: Boris Zbarsky <bzbarsky@mit.edu>
Date: Fri, 14 Nov 2014 14:48:33 -0500
Message-ID: <54665C91.4060305@mit.edu>
To: Allen Wirfs-Brock <allen@wirfs-brock.com>
CC: "public-script-coord@w3.org" <public-script-coord@w3.org>
On 11/14/14, 2:40 PM, Allen Wirfs-Brock wrote:
> I don't really feel very good about by default tying allocation behavior to the realm of the this value rather than the realm of the current function.

Can we define "allocation"?

Again, my proposal is that if we know the function always allocates a 
new object then the allocation happens in the realm of that function. 
If, on the other hand, the function caches the object and only allocates 
it if the cache is empty, then it makes more sense to treat that as if 
the object had existed all along...

> In all honesty, cases where somebody intentionally uses call/apply to force the realm of the method to be different from the realm of the this value

No one does that.  What happens in practice is that someone uses 
call/apply to call a canonical method they grabbed up front before 
someone could have messed with standard prototypes on all sorts of 
objects, some of which were born in a different realm.  They're not 
trying to force anything when they do that.

> As long as implementors do what the spec. says, people who do such strange things can expect interoperable results but it is up to them to determine whether their weird ness makes any useful sense.

This is complicated in this case by implementors currently not doing 
what the spec would say for DOM stuff, and it being not clear whether 
content is relying on that behavior.  :(

-Boris
Received on Friday, 14 November 2014 19:49:02 UTC

This archive was generated by hypermail 2.4.0 : Friday, 17 January 2020 17:14:23 UTC