[Disclaimer: I'm not an expert at server code. That said...]

Don't you generally need to manage the policy for these kinds of requests 
manually anyway? In particular, you can't actually tell if a user has abandoned 
their session, since the browser doesn't let you know when that's happened. So 
it's up to your server to decide what policies to use for expiring requests.

With strong maps, you can do all this stuff explicitly, but it's not dependent 
on the GC:

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

With weak maps (which BTW are just a renaming of ephemeron tables), you depend 
on the GC for memory management, but you don't get enumeration. This was always 
the case with the design, even before the renaming.

MarkM designed them this way in order to avoid security issues (he can probably 
explain these issues better than I), but there are portability issues as well: 
if you expose the current set of bindings in the table to programs, then they 
will be able to depend on the non-deterministic behavior of the GC. Experience 
shows that when specs introduce unspecified behavior, the web begins to depend 
on implementation-specific details.

Dave

On Apr 7, 2011, at 4:13 PM, Mikeal Rogers wrote:

> requests come in to a server, you want to stick them in a hash so that you 
> can query the server at any time for all the "current" queries.
> 
> the problem is that, when using objects, you'll always leak. there are too 
> many reasons a request might "go away" and too many asynchronous "owners" of 
> that request to reliably remove it from the hash, especially in node. 
> 
> ephemeron tables looked like a good way to solve this, we can stick them in 
> the table and when nobody else has a reference to them they get collected. at 
> any point we can query the server for all existing request/response objects.
> 
> if we have no way to enumerate the map we can't do this.
> _______________________________________________
> 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

Reply via email to