JavaScript WeakMap, a design from c cpp bit-diddler mindset (2026)
JavaScript WeakMap. from bit diddlers
- JavaScript WeakMap.
- this fucking thing, i never quite understood.
- it has to do with bit-diddlers.
- its is non-trivial, to document its behavior, sans handwaving of some 'garbage-collection' fuck.
a quick mathematical documentation of js weakmap is this: like normal map, with 3 exceptions:
- 1. keys can only be object type.
- 2. if a object in the key is no longer used elsewehere in your program, that key entry auto get deleted.
- 3. weakmap cannot be iterated over.