`free` operator

Patrick Mueller pmuellr at gmail.com
Thu Oct 25 22:28:29 PDT 2012


On Thu, Oct 25, 2012 at 8:20 PM, John J Barton
<johnjbarton at johnjbarton.com>wrote:

> On Thu, Oct 25, 2012 at 4:16 PM, Isaac Schlueter <i at izs.me> wrote:
> > It'd be really nice if JS had a way to explicitly delete an object.
>
> I guess you mean ... a way to set all the refs to a object to undefined.
>

Isaac's `free` sounds like Smalltalk's one-way `become: nil`:


http://live.exept.de/doc/online/english/programming/classicBugs.html#BUG8
    http://gbracha.blogspot.com/2009/07/miracle-of-become.html

Probably not the best idea to be using this in production code.  For
debugging though, AWESOME.  And once we have classes, `allInstances()` will
be nice as well. :-)

Wondering if, for node.js anyway, you could use the V8 HeapSnapshot to find
your references:

    http://v8.googlecode.com/svn/trunk/include/v8-profiler.h

Didn't proxies have some way of doing a become: and freezing themselves as
a new object?  Maybe that was the older Proxy stuff, didn't see it in the
current drafts.  But did see "Revokable Proxies", which sounds like it
might fit the bill, though you'd have to arrange to proxy the sketchy
object early:

    http://wiki.ecmascript.org/doku.php?id=strawman:revokable_proxies

-- 
Patrick Mueller
http://muellerware.org
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20121026/d8336865/attachment-0001.html>


More information about the es-discuss mailing list