slikts/tuplerone

Add support for primitives

dy opened this issue · 3 comments

dy commented

Primitives can be mapped to standard boxes via primitive-pool or similar technique.

Would make tuplerone truly great.

@slikts

Please see WeakishMap; the same can be done more simply by just using a Map for primitive keys. The issue why there still needs to be at least one non-primitive key is that it allows for the tuple (the mappings and the tuple object) to be collectible by GC if the non-primitive key stops being referenced anywhere. If there were only primitive keys, the tuple would never be collected, since it would always be reachable by the primitive keys.

Also, you've left out a type of primitives – symbols. 🙂

Fixed by adding UnsafeTuple in v3.