You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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.
The text was updated successfully, but these errors were encountered:
This Clear method is not exposed to JavaScript. It is used by the WeakMap finalizer to remove all of its references from the key objects when the WeakMap itself is garbage collected.
Are there any plans to remove
.clear()
fromWeakMap
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.
The text was updated successfully, but these errors were encountered: