2012/10/20 Axel Rauschmayer <[email protected]>

> 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
_______________________________________________
es-discuss mailing list
[email protected]
https://mail.mozilla.org/listinfo/es-discuss

Reply via email to