Overriding Map/etc with get/set hooks?
samth at ccs.neu.edu
Tue May 21 03:01:54 PDT 2013
On Tue, May 21, 2013 at 2:52 AM, Anne van Kesteren <annevk at annevk.nl> wrote:
> On Tue, May 21, 2013 at 8:11 AM, Sam Tobin-Hochstadt <samth at ccs.neu.edu> wrote:
>> 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?
> Well basically, you want an object that's a Map for all intents and
> purposes, but does a couple of things differently. So e.g. you need a
> custom set and all Map operations that use set need to use that new
> set. Tab's original message explains that however as far as I can tell
> so it's not entirely clear to me what we're missing.
No, you don't need to do anything differently. Conceptually, there
are three things you need:
1. When the Map is created, before it's handed to the program, some
items are added.
2. Some platform operations also change this map in addition to doing
the other things they do.
3. Some other set of platform operations consult this map when doing
their other work.
Obviously, this is the spec perspective; an implementation could have
some magic version of the Map that does the update of the internal
platform state eagerly when map.set() is called.
More information about the es-discuss