# Allow weak maps to contain primitives

**URL:** <https://es.discourse.group/t/allow-weak-maps-to-contain-primitives/1051>\
**Category:** 💡 Ideas\
**Created:** [October 23, 2021, 12:15am UTC](https://es.discourse.group/t/allow-weak-maps-to-contain-primitives/1051 "2021-10-23T00:15:03Z")\
**Posts on this page:** 1\
**Showing post:** 9

<div class="post-metadata">

**Author:** ![aclaymore](https://yyz2.discourse-cdn.com/free1/user_avatar/es.discourse.group/aclaymore/32/501_2.png) [@aclaymore](https://es.discourse.group/u/aclaymore)\
**Post date:** [October 23, 2021, 7:33am UTC](https://es.discourse.group/t/allow-weak-maps-to-contain-primitives/1051/9 "2021-10-23T07:33:56Z")

</div>

Even if I create two identical strings the engines won’t necessarily immediately inturn those two values into the same heap object.  
So when I drop a reference to the first one, that object may no longer be live but the identical one is.

WeakRefs storing objects has simpler semantics to define because objects are not forgeable. Two different js object values are never equal.

To clarify: if a WeakRef has dropped its ref then that is a guarantee that the object it was pointing to can no longer suddenly re-appear.

---

_[View the full topic](https://es.discourse.group/t/allow-weak-maps-to-contain-primitives/1051)._
