Fwd: Improving Function.prototype.bind

Mark S. Miller erights at google.com
Sun Jan 8 17:07:43 PST 2012


Sorry about the format mangling. Resending with simpler formatting which
hopefully won't get mangled in transmission.

---------- Forwarded message ----------
From: Mark S. Miller <erights at google.com>
Date: Sun, Jan 8, 2012 at 5:05 PM
Subject: Re: Improving Function.prototype.bind
To: Brendan Eich <brendan at mozilla.com>
Cc: John J Barton <johnjbarton at johnjbarton.com>, es-discuss <
es-discuss at mozilla.org>


On Sun, Jan 8, 2012 at 3:35 PM, Brendan Eich <brendan at mozilla.com> wrote:
[...]

>  That's not totally clear now in light of Mark's emulated WeakMap not
> leaking in practice.
>
[...]

That's a much stronger claim than I would be willing to make. My emulated
WeakMaps leak much less that one would expect, and indeed less than I
thought possible when I began the exercise. But the remaining extra leak is
still significant for real uses.

>From <http://code.google.com/p/es-lab/source/browse/trunk/src/ses/WeakMap.js
>:


 /**
 * This {@code WeakMap} emulation is observably equivalent to the
 * ES-Harmony WeakMap, but with leakier garbage collection properties.
 *
 * <p>As with true WeakMaps, in this emulation, a key does not
 * retain maps indexed by that key and (crucially) a map does not
 * retain the keys it indexes. A map by itself also does not retain
 * the values associated with that map.
 *
 * <p>However, the values associated with a key in some map are
 * retained so long as that key is retained and those associations are
 * not overridden. For example, when used to support membranes, all
 * values exported from a given membrane will live for the lifetime
 * they would have had in the absence of an interposed membrane. Even
 * when the membrane is revoked, all objects that would have been
 * reachable in the absence of revocation will still be reachable, as
 * far as the GC can tell, even though they will no longer be relevant
 * to ongoing computation.



-- 
    Cheers,
    --MarkM



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


More information about the es-discuss mailing list