What is the status of Weak References?

Mark Miller erights at gmail.com
Thu Jan 31 20:27:43 PST 2013


Hi Tab, not quite. WeakMaps and WeakRefs address mostly disjoint use cases.
WeakRefs cannot be used to fully emulate the GC virtues of WeakMaps on the
one hand, and WeakMaps cannot be used to make an object accessible only
until it is not *otherwise* referenced. We separated the two because the
former is deterministic and can be made freely available to unprivileged
code. The latter make non-deterministic GC decisions visible. Separating
these abstractions clarifies both.

I do not recall anyone deciding to drop weak refs, as opposed to just
postponing them. I hope to see them in ES7.


On Thu, Jan 31, 2013 at 1:55 PM, Tab Atkins Jr. <jackalmage at gmail.com>wrote:

> On Thu, Jan 31, 2013 at 1:48 PM, Kevin Gadd <kevin.gadd at gmail.com> wrote:
> > A search shows some old discussions of the topic mentioning that they
> > might be going in to future versions of the language, etc. But on the
> > other hand I've been told in response to this question before that
> > TC39 has a general policy against features that allow garbage
> > collection to be visible to applications.
> >
> > There's still a strawman up on the wiki:
> > http://wiki.ecmascript.org/doku.php?id=strawman:weak_references and
> > while it appears to be a relatively simple, sane way to expose weak
> > references, it looks like the strawman hasn't been touched since late
> > 2011. Is that because it's dead? Or was it deprioritized because weak
> > references are believed to not be needed by JS application developers?
>
> I believe that proposal was dropped in favor of just always using WeakMaps.
>
> ~TJ
> _______________________________________________
> es-discuss mailing list
> es-discuss at mozilla.org
> https://mail.mozilla.org/listinfo/es-discuss
>



-- 
Text by me above is hereby placed in the public domain

  Cheers,
  --MarkM
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20130131/77e9ab6b/attachment.html>


More information about the es-discuss mailing list