Closed
Description
Are there any plans to remove .clear()
from WeakMap
to make the implementation compliant with the specification? Other engines have removed it and aligned to the final spec. Having deprecated/removed API isn't a zero sum game as it maintaining the feature in perpetuity can have future consequences and developers can latch onto functionality that they shouldn't. Wouldn't it be better to "break" anyone mistanklingly using this API now than in 10 years.
I would have also assumed by the nature of the ECMAScript WeakMap that there could be an optimisation by not having to track the pointers in the map directly in the WeakMap to support clear, making the GC algorithm/detection more efficient.