es6-map-shim
es6-map-shim copied to clipboard
Why can't it be shimmed?
The readme says Map can't be shimmed. Why?
+1
I don't see any reason why ES6 maps cannot be shimmed. It is just a regular object with methods. What is the problem shimming it?
I believe the reason is that ES6 Map requires support for both arbitrary Object
keys and average constant time get
/has
/delete
. It's possible to support one or the other, but without access to an "object ID" or other value that could serve as a universal hash, not both.
For posterity, @eriwen answered on this commit:
A few reasons:
- There are far better shims (like https://github.com/WebReflection/es6-collections)
- Iteration (for...of) cannot be shimmed (though one could argue that's not crucial)
- Apple forbids contributing to OSS, so I couldn't work on this if I wanted to.