Overriding Map/etc with get/set hooks?

Tom Van Cutsem tomvc.be at gmail.com
Wed May 22 02:55:30 PDT 2013

2013/5/21 Brendan Eich <brendan at mozilla.com>

> David Bruant wrote:
>> This description ("arbitrary string keys", "bidirectional link with style
>> rule") suggests that you want a proxy (canonical values are in the style
>> rule, the proxy is just a façade with a bit of validation/coercion logic).
>> That's the sort of use case they've been introduced for.
> I don't see why a proxy is required if the API is get/set/has (like
> Map's). We're not making properties appear without knowing their names, so
> this is not a proxy use-case on its face.

My 2c: I agree, don't express this as a proxy. You want a simple key-value
mapping. Expressing that as a proxy drags in lots of unnecessary aspects
of JS's object model (e.g. prototypes, property attributes, etc.) You don't
want/need to do that for this abstraction.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20130522/3d1f57bc/attachment.html>

More information about the es-discuss mailing list