Overriding Map/etc with get/set hooks?

Sam Tobin-Hochstadt samth at ccs.neu.edu
Tue May 21 00:11:27 PDT 2013


On Mon, May 20, 2013 at 11:58 PM, Tab Atkins Jr. <jackalmage at gmail.com> wrote:
> On Mon, May 20, 2013 at 11:24 PM, Sam Tobin-Hochstadt <samth at ccs.neu.edu> wrote:
>> Is it possible for the environment to change the Map during the turn?
>>
>> IOW, is this always true?
>>
>> m.set("x", 1);
>> assert(m.get("x") === 1);
>
> Your example is not a restatement of your question.
>
> Yes, the "environment" can change the map during the turn.  But the
> map isn't affected by arbitrary things in the "environment" - it just
> shares its internal data with another object which is also user
> read/writeable.  The only way the map can change without a .set() call
> is if your code does some CSSOM manipulation that changes the custom
> properties in the associated style rule.

Ok, that's what I thought was going on.  We can make some other
function calls which might mutate the Map, just as with any other Map
that we get from someone else. In that case, my response to Anne
stands -- why is any spec magic needed at all?

Sam


More information about the es-discuss mailing list