Overriding Map/etc with get/set hooks?

Brendan Eich brendan at mozilla.com
Tue May 21 07:20:00 PDT 2013


Anne van Kesteren wrote:
> On Tue, May 21, 2013 at 12:19 PM, Brendan Eich<brendan at mozilla.com>  wrote:
>> So Tab: why do you want to abuse Map instead of make a custom class?
>
> As we tried to explain before, the believe is that a lot of Map
> generics will work directly on this Map-like object, similar to how we
> want Array methods to work directly on NodeList&  co, despite NodeList
> not being a JS Array (not mutable for one).

So? Make your custom map-ish thing map-like, just as array-likes work 
with Array generics: by duck typing.

/be


More information about the es-discuss mailing list