Template site objects and WeakMap
inglor at gmail.com
Wed Jun 17 17:59:48 UTC 2015
It would return a different object each time (for the same Symbol, like new String) so it would not exhibit the problem of being observable.
> On Jun 17, 2015, at 20:54, Jordan Harband <ljharb at gmail.com> wrote:
> Could I not use `Object(Symbol.for('some global registry symbol'))` as a `WeakMap` key? That would return a realm-specific object, of course.
>> On Wed, Jun 17, 2015 at 10:19 AM, Benjamin Gruenbaum <inglor at gmail.com> wrote:
>> > congratulations and THANK YOU! I learned something important reading your messages. The notion that we can preserve non-observability when making one thing a WeakMap iff we make all other WeakMaps be strong for those same objects is true, novel, and very surprising. I have been working on such concepts for decades and never come across anything like it.
>> I apologize, I understand the problem with a weak registry forcing observable garbage collection in user code - that's nice but isn't this always the case with references to objects when an object pool/flyweight is used?
>> Isn't this the same issue as `==` working on strings that have string objects interned but possibly GC'd (and precisely why Java never collects interned strings)?
>> es-discuss mailing list
>> es-discuss at mozilla.org
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the es-discuss