Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Facade WeakMap and WeakSet #4915

Open
armanbilge opened this issue Nov 30, 2023 · 0 comments
Open

Facade WeakMap and WeakSet #4915

armanbilge opened this issue Nov 30, 2023 · 0 comments

Comments

@armanbilge
Copy link
Member

armanbilge commented Nov 30, 2023

Typically these collection facades are accompanied by a "wrapper" to implement Scala collection APIs e.g.

/** Wrapper to use a js.Map as a scala.mutable.Map */
@inline
final class WrappedMap[K, V](private val underlying: js.Map[K, V])
extends mutable.AbstractMap[K, V]
with mutable.MapOps[K, V, mutable.Map, js.WrappedMap[K, V]] {

However, in this case neither WeakMap nor WeakSet can fully implement any Scala collection API because they are not iterable.

So I suppose the pattern here would be to add WeakMapOps and WeakSetOps, that add Scala collections-like syntax to the facades for supported ops.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant