WeakRef
A weak reference to T: holds its referent without keeping it alive.
get returns the referent, or null once it has been collected or after clear. Check isWeakSupported before leaning on collection for correctness.
Platform behaviour:
JVM, Android, Apple/Native: the platform's own weak reference.
JS: the ES2021
WeakRefglobal. On an older runtime, and for referents backed by JS primitives (String, boxed numbers) thatWeakRefwill not accept, the referent is held strongly instead.
This is the engine's only expect/actual. WeakMap and WeakSet need it and there is no multiplatform weak reference in the standard library.