es6-map-shim icon indicating copy to clipboard operation
es6-map-shim copied to clipboard

Why can't it be shimmed?

Open callumlocke opened this issue 9 years ago • 4 comments

The readme says Map can't be shimmed. Why?

callumlocke avatar Apr 10 '15 21:04 callumlocke

+1

dgreensp avatar Jul 08 '15 15:07 dgreensp

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?

sergoklimo avatar Dec 02 '15 09:12 sergoklimo

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.

jfirebaugh avatar Oct 18 '16 18:10 jfirebaugh

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.

kenbellows avatar Oct 16 '19 17:10 kenbellows