es7 proposal/polyfill?: base Map/WeakMap off Proxy + Weak References

Steve Fink sphink at gmail.com
Mon Feb 22 17:42:44 UTC 2016


On 02/19/2016 01:06 PM, Coroutines wrote:
> On Fri, Feb 19, 2016 at 1:03 PM, Tab Atkins Jr. <jackalmage at gmail.com> wrote:
>> On Fri, Feb 19, 2016 at 12:59 PM, Boris Zbarsky <bzbarsky at mit.edu> wrote:
>>> On 2/19/16 3:50 PM, Coroutines wrote:
>>>> Side discussion: Why does Javascript have this limitation? - what I
>>>> view as a limitation?  You'd think this could be supported without
>>>> breaking older JS..
>>> I don't see how it could.  I'll bet $50 someone out there is using
>>> obj[location] for example.
>> Yes, relying on the stringification behavior is very common.
>> Absolutely no way to change it at this point without something like
>> AWB's (abandoned) Object Model Reformation proposal
>> <http://wiki.ecmascript.org/doku.php?id=strawman:object_model_reformation>
>> that would allow changing the behavior of [].
> Learning to dance around the broken relics of the old world forever... :(

Not in this case, imho. A string-keyed map is a very different data 
structure in my mind than an object-keyed map. An object-keyed map works 
off of object identity, which is straightforward until you start 
introducing value objects. But it also means that in order to look 
something up, you have to have the *original* object. That data 
structure is useful, and I'm glad we finally have it available as Map, 
but restricting property keys to strings (and Symbols) makes things a 
lot simpler both from users' and implementers' points of view. (We 
[SpiderMonkey] used to have object-keyed properties with E4X, and it was 
a nuisance.)



More information about the es-discuss mailing list