Re: Determining what prototype should be used for an object

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