Skip to content
This repository has been archived by the owner on Jan 25, 2022. It is now read-only.

Iterable WeakMap implementation in README is incorrect? #213

Open
benjamingr opened this issue Nov 3, 2020 · 0 comments · May be fixed by #216
Open

Iterable WeakMap implementation in README is incorrect? #213

benjamingr opened this issue Nov 3, 2020 · 0 comments · May be fixed by #216

Comments

@benjamingr
Copy link

See discussion here: nodejs/node#35915 (comment)

The set implementation always creates a new WeakRef which means that seting the same thing twice sets two keys since:

var m = new Map();
var o = {};
var r1 = new WeakRef(o);
var r2 = new WeakRef(o);
m.set(r1, "foo");
console.log(m.get(r1)); // foo 
console.log(m.get(r2)); // undefined

cc @bcoe

ExE-Boss added a commit to ExE-Boss/tc39-proposal-weakrefs that referenced this issue Jan 10, 2021
@ExE-Boss ExE-Boss linked a pull request Jan 10, 2021 that will close this issue
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant