Re: David’s ProxyMap

David Bruant bruant.d at gmail.com
Sat Oct 20 10:54:50 PDT 2012


2012/10/20 Axel Rauschmayer <axel at rauschma.de>

> https://gist.github.com/3918227
>
> I’m wondering what this approach does better.
>
Originally, it really was to give some (built-in) syntactic sugar to
(Weak)Map. No plan to make objects better. At most sharing a simpler object
model than the ES5 one.


> Given the 3 objects-as-maps pitfalls [1], we have:
>
> 1. Accidentally accessing inherited properties: fixed
> 2. Can’t safely invoke methods, because those might be overridden: still a
> problem (right?)
> 3. __proto__: fixed
>
I see what I've written as maps with sugar, not really as objects.
maps-as-objects if you will :-) Specifically, calling "methods" makes
almost no sense... Maybe it does actually. Interesting. I need to give it
more thoughts.
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. I'm glad
it's possible to not inherit from Object.prototype as well as being able to
shadow properties. About maps-as-objects, they have no inheritance, so I'm
not sure the second point applies to it.

About the third point, maps-as-objects are indeed better, because all
problems with pseudo-properties are avoided without sacrifying syntax
(which all other solutions have to do).

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


More information about the es-discuss mailing list