Save Object.observe()! (please) + make WeakMap/WeakSet observable.
Coroutines
coroutines at gmail.com
Wed Nov 4 13:16:06 UTC 2015
On Wed, Nov 4, 2015 at 4:56 AM, Romuald Quantin <romu at soundstep.com> wrote:
> As an aside and as Coroutines,
>
> I never understood why there is this inability to enumerate WeakMap keys.
>
If I had it my way there would be no WeakMap or WeakSet. I'd have a
Symbol.mode similar to Lua's __mode meta(method/field?) that would show the
garbage collector that keys or values are weakly referenced in an object.
Or even:
obj[Symbol.weakValues] = true;
obj[Symbol.weakProperties] = true;
WeakMap isn't really all that special. Set is important for how it
maintains only unique values are inserted - but you could do this with
Proxy. I think I come across as a Lua fanboy... I enjoyed the minimalism
of Lua for sure :-)
I wish I could have weak references in arrays... :3 Iterate to .length,
skipping undefined/null values (where things have been collected).
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20151104/b1b8bfb7/attachment.html>
More information about the es-discuss
mailing list