Re: David’s ProxyMap

Axel Rauschmayer axel at rauschma.de
Sat Oct 20 10:59:42 PDT 2012


> 1. Accidentally accessing inherited properties: fixed
> 2. Can’t safely invoke methods, because those might be overridden: still a problem (right?)
> 3. __proto__: fixed
> [...]
> About your second point, it assumes that we want all objects to have Object.prototype methods. I'm not so sure it should be a goal.

It’s loosely related to Allen’s object model reformation [1]: you’d want the [] “operator” to get and set collection elements, but would still want to be able to invoke map-related methods. Currently, the two are mutually exclusive.

Another idea: one could use the `in` operator to check whether a key exists in the map (only for ProxyMap at the moment, possibly for all collections in the future).

Currently, proxies make no distinction between a property read access and a method invocation. In my experience, it would be nice if that distinction would be there – if only that one didn’t have to curry for method invocations which must be a performance issue and is a fairly common use case (remotely invoking web services etc.). Now, there are reasons against this and I’m mainly wondering if actually using the new API has changed your or Tom’s mind.

Axel

[1] http://wiki.ecmascript.org/doku.php?id=strawman:object_model_reformation

-- 
Dr. Axel Rauschmayer
axel at rauschma.de

home: rauschma.de
twitter: twitter.com/rauschma
blog: 2ality.com

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20121020/e0f6a950/attachment-0001.html>


More information about the es-discuss mailing list