Overriding Map/etc with get/set hooks?

Sam Tobin-Hochstadt samth at ccs.neu.edu
Mon May 20 23:24:36 PDT 2013


On Mon, May 20, 2013 at 11:17 PM, Tab Atkins Jr. <jackalmage at gmail.com> wrote:
> On Mon, May 20, 2013 at 11:10 PM, Sam Tobin-Hochstadt <samth at ccs.neu.edu> wrote:
>> On Mon, May 20, 2013 at 10:32 PM, Tab Atkins Jr. <jackalmage at gmail.com> wrote:
>>> All of these are easy to do if this is just a Map (or has Map on its
>>> prototype chain), but with a custom [[MapData]] whose behavior is
>>> defined by my spec.
>>
>> Would another way to think about this be as a regular plain-old Map,
>> but which is updated imperatively by the environment sometimes, and is
>> also read by the environment?
>
> Sure, that's also valid.
>
>> Or does changing the map also change
>> some part of the style of the page _immediately_, rather than at the
>> end of the turn?
>
> It would be best if it happened immediately.  There's no
> performance-related reason not to make it sync, and high potential for
> confusion if you use one method to write it, another tool uses the
> other method to read it, and they don't sync up.  It's just a
> (necessary) convenience API for reading/writing the CSS properties
> directly.

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);

Sam


More information about the es-discuss mailing list