Use cases for WeakMap

Mark S. Miller erights at google.com
Sat May 14 23:59:07 PDT 2011


On Sat, May 14, 2011 at 11:57 PM, Erik Corry <erik.corry at gmail.com> wrote:

>
> On May 15, 2011 2:55 AM, "Boris Zbarsky" <bzbarsky at mit.edu> wrote:
> >
> > On 5/14/11 6:37 PM, Oliver Hunt wrote:
> >>
> >> Can you provide a use case where you have an object key as the usual
> programming idiom?
> >
> >
> > Attaching metadata to object without polluting the objects themselves.
>
> That sounds more like private names
>
Private name and soft field lookup inherits. WeakMap lookup doesn't.



> >
> > For example, Firefox extensions want to do this all the time for various
> DOM objects (and especially Window).
> >
> > -Boris
> >
> > _______________________________________________
> > es-discuss mailing list
> > es-discuss at mozilla.org
> > https://mail.mozilla.org/listinfo/es-discuss
>
> _______________________________________________
> es-discuss mailing list
> es-discuss at mozilla.org
> https://mail.mozilla.org/listinfo/es-discuss
>
>


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


More information about the es-discuss mailing list