Open ljharb opened 4 years ago
Interesting! Yes, WeakMap
and WeakSet
could support readOnlyView()
. We could easily extend the shim to shim these as well.
It actually makes sense for all of snapshot
/diverge
/readOnlyView
to apply to weak collections. snapshot
and diverge
are sufficiently hard to emulate in userland that I don't expect anyone to shim these. The open question is: For a platform using the transposed representation of weak collections, could snapshot
and diverge
be provided without undue implementation burden? If not, I'd consider that a show stopper.
But readOnlyView
should still be provided regardless.
I'm for .readOnlyView
only - the explanation by the link above.
I want to be able to pass around say, a WeakSet, without granting the ability to add things to it, or remove things from it. Why can't I?