3 ms·
> we mentioned a concept that Go uses to implement its unique map feature: the “weak pointer.” I assume that's just a redundant way to say that the map doesn't
by Terr_ 2y ago
> we mentioned a concept that Go uses to implement its unique map feature: the “weak pointer.”
I assume that's just a redundant way to say that the map doesn't allow duplicate keys. If the author means it is a novel data structure, then I'd point towards java.util.WeakHashMap from 26 years ago.
Other fun variations (depending on your memory mechanics) are "soft" references (hints to GC to avoid collecting them if possible) and and "phantom" references (detect an object has been GCed.)