ES accessor usage guidelines (Was: Map/Set.prototype.size)

Brendan Eich brendan at mozilla.org
Tue Oct 16 14:11:47 PDT 2012


Erik Arvidsson wrote:
> On Mon, Oct 15, 2012 at 12:23 PM, Brendan Eich<brendan at mozilla.org>  wrote:
>> * get/set accessor may have effects on 'set' (see the DOM) but only on the
>> receiver object (and unobservably, any children that become garbage, e.g.
>> when trimming .length on an array-like).
>
> That is very limiting, even as a guideline. Any time there are two or
> more related objects it is very likely that a setter might affect some
> other object.

You're right, and my children-may-become-garbage loophole wasn't wide 
enough. But children-might-be-orphaned-with-null-parentNode is not bad, 
as a wider loophole. Are we really talking about significant [*] 
unrelated changes outside the container whose setter was invoked?

/be

[*] Sure, lots of things can change, especially due to events, even 
ignoring observers and such. Events bubbling up was something I left out 
altogether.


More information about the es-discuss mailing list