...does a weak map not provide that functionality? ...additionally, if writing something that sophisticated, then not managing your own instances (i.e. Relying on the language to do it for you) is the same mentality that produces horrible java code.
I also agree with what was said previously... how are weak references going to help you with ipc (inter process communication) referencing? On Dec 28, 2016 6:00 AM, <[email protected]> wrote: Send es-discuss mailing list submissions to [email protected] To subscribe or unsubscribe via the World Wide Web, visit https://mail.mozilla.org/listinfo/es-discuss or, via email, send a message with subject or body 'help' to [email protected] You can reach the person managing the list at [email protected] When replying, please edit your Subject line so it is more specific than "Re: Contents of es-discuss digest..." Today's Topics: 1. Weak Reference proposal (Isiah Meadows) 2. Resource management (Isiah Meadows) 3. Re: Weak Reference proposal (Steve Fink) ---------- Forwarded message ---------- From: Isiah Meadows <[email protected]> To: "[email protected]" <[email protected]> Cc: Date: Tue, 27 Dec 2016 07:45:32 -0500 Subject: Weak Reference proposal The weak reference proposal <https://github.com/tc39/proposal-weakrefs> hasn't seen a lot of activity, and I haven't found much news elsewhere on it. What's the status on it? Where I'm building a language-integrated process pool in Node.js, complete with shared "references" and async iterator support, I really badly need weak references to avoid otherwise inevitable memory leaks across multiple processes if the references aren't explicitly released. So far, my only option is to take a native dependency (I have no other dependencies), but that's very suboptimal, and it eliminates the possibility of porting to browsers. So I really badly need language-level weak references. ----- Isiah Meadows [email protected] ---------- Forwarded message ---------- From: Isiah Meadows <[email protected]> To: "[email protected]" <[email protected]> Cc: Date: Tue, 27 Dec 2016 11:25:11 -0500 Subject: Resource management In [this GH issue in the async iteration proposal][1], I found that the async iteration concept itself could theoretically be used for resource management, such as in this example (copy/pasted from my initial issue): ```js const fsp = require("fs-promise") async function *open(file, opts) { const fd = await fsp.open(file, opts) try { yield fd } finally { await fsp.close(fd) } } for await (const fd of open("/path/to/file", {mode: "r+"})) { const bit = await fsp.read(fd) // do other things... } // descriptor automatically closed, so no resource leaks! ``` It's neat and all, but we *really* should have something much better than that. Maybe something like this? ```js // Strict mode only with (const fd = await open("/path/to/file", {mode: "r+"})) { const bit = await fsp.read(fd) // do other things... } ``` (I'm not totally sure about what methods the closeable/etc. API or protocol should use.) [1]: https://github.com/tc39/proposal-async-iteration/issues/68 ----- Isiah Meadows [email protected] ---------- Forwarded message ---------- From: Steve Fink <[email protected]> To: [email protected] Cc: Date: Tue, 27 Dec 2016 13:34:38 -0800 Subject: Re: Weak Reference proposal On 12/27/2016 04:45 AM, Isiah Meadows wrote: The weak reference proposal <https://github.com/tc39/proposal-weakrefs> hasn't seen a lot of activity, and I haven't found much news elsewhere on it. What's the status on it? Where I'm building a language-integrated process pool in Node.js, complete with shared "references" and async iterator support, I really badly need weak references to avoid otherwise inevitable memory leaks across multiple processes if the references aren't explicitly released. So far, my only option is to take a native dependency (I have no other dependencies), but that's very suboptimal, and it eliminates the possibility of porting to browsers. So I really badly need language-level weak references. Would weak references be enough to solve cross-process garbage collection? How would you recover a cycle of references among your processes? _______________________________________________ es-discuss mailing list [email protected] https://mail.mozilla.org/listinfo/es-discuss
_______________________________________________ es-discuss mailing list [email protected] https://mail.mozilla.org/listinfo/es-discuss

