Could WeakRef be transpiled to use WeakMap? Feels like it could...
-
-
-
WeakMap only holds the *keys* weakly. Unfortunately "WeakMap" is a misleading name. The "right" name is "Ephemeron" https://en.m.wikipedia.org/wiki/Ephemeron
- 1 more reply
New conversation -
-
-
I kinda want to understand weakrefs, but I've honestly no idea when I'd actually use them — then again, I'd typically be inclined to write my own GC for caches rather than rely on the object no longer being referenced, as that could be temporary
-
That's the point. You don't know what data is still in use except you implement your own reference counting. Own reference counting is inefficient and main thread blocking. With WeakRef and FinalizationGroup you can perform cache cleanup only if needed, that's awesome!
- 2 more replies
New conversation -
-
-
Interesting. I recall back when Weak* was first being added and WeakMap was the "compromise" as a WeakRef-type feature adds some non-determinism (and maybe possible side-channel?) based on GC behavior (as called out in the "Note of Caution"). Cool feature though!
Thanks. Twitter will use this to make your timeline better. UndoUndo
-
-
-
I can predict caching libs to React in 3... 2... 1...
Thanks. Twitter will use this to make your timeline better. UndoUndo
-
-
-
@firefox creates kind of weak references in extensions sometimes, unfortunately it often collects stuff that clearly is still required and everything breaks, another chromium-WE incompatibility making porting PITAThanks. Twitter will use this to make your timeline better. UndoUndo
-
-
-
I have written entire frameworks on the basis of weakrefs in as3 times ten years ago... Loooong overdue!
Thanks. Twitter will use this to make your timeline better. UndoUndo
-
-
-
interesting! Whats the real world use case for weakRef?
Thanks. Twitter will use this to make your timeline better. UndoUndo
-
Loading seems to be taking a while.
Twitter may be over capacity or experiencing a momentary hiccup. Try again or visit Twitter Status for more information.
JavaScript, HTML, CSS, HTTP, performance, security, Bash, Unicode, i18n, macOS.