Overriding Map/etc with get/set hooks?
Tab Atkins Jr.
jackalmage at gmail.com
Mon May 20 22:40:01 PDT 2013
On Mon, May 20, 2013 at 10:33 PM, Domenic Denicola
<domenic at domenicdenicola.com> wrote:
> On May 21, 2013, at 1:28, "Tab Atkins Jr." <jackalmage at gmail.com> wrote:
>> On Mon, May 20, 2013 at 10:20 PM, Domenic Denicola
>> Is<domenic at domenicdenicola.com> wrote:
>>> Oh, I must have misread your original message. I thought it did not allow storing non-string keys. If it can allow storing any kind of key, like a Map, and it's just the initial data you're referring to, then maybe it is a Map. As long as the contract that `map.set(x, y); map.get(x) === y` works for any `x` and `y`, then you're probably fine.
>> It's a string-keyed map, but that just means that you toString
>> everything, as Anne says. Your contract is still maintained, assuming
>> a non-degenerate toString.
> Right, I guess it's this contract that gets broken: `x !== y` implies `map.set(x, 1); map.set(y, 2); map.get(x) === 1; map.get(y) === 2`.
Yes, because it's a string map rather than an object map. But that
difference doesn't justify breaking all the qualities I listed in my
More information about the es-discuss