Hello internals, I know now that some of you are swamped getting ready for 8.4, so I want to be clear that this will be an 8.5+ thing. I am simply sending it to the list in case anyone wants to discuss it, burn it with fire, give it a gold star, or ignore until later.
Currently, a WeakMap may only have object keys, and this logically makes a lot of sense. However, there are cases where you want to reference an object by a value but if the value is no longer referenced, no longer need it. A good example of this might be used in dependency injection containers, lookup tables for value objects, etc. I'd like to propose a ReverseWeakMap where the keys must be scalar, and given an object as the value. Once the value is no longer referenced, the key and value is removed from the ReverseWeakMap. — Rob