[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: mirage + froc = self-scaling?

Le mardi, 9 avril 2013 Ã 23:50, Daniel BÃnzli a Ãcrit :
> Unless I'm mistaken it is essentially going to be a trivial rewrite of that 
> weak.js file with WeakMap to get the correct weak semantics. You will however 
> have to bet on ecmascript 6's eventual adoption.

It turns out that I am mistaken.  

WeakMap has weak *keys*, keys must be objects and there's no way to enumerate 
the keys of a map. These properties allow for a very simple implementation with 
the help of private symbols [1]. You can even implement it in the current 
javascript though you cannot guarantee that someone won't fiddle with your 
private field.  

But these very weak properties don't seem to allow to implement a weak 
reference (and hence weak arrays).  

However it may be possible to prevent the leaks by simply introducing a 
function in react that enables some kind of manual management that would need 
to be done only at the leaves (output) of the dag --- this would be similar to 
what is mentioned here ([2], last paragraph) about the implementation of pec, 
but without its implementation cost [3] as we still have the forward pointers. 
But I have to think a little bit more about this.



[1] http://blog.ezyang.com/2013/03/duality-of-weak-maps-and-private-symbols/
[2] https://sympa.inria.fr/sympa/arc/caml-list/2012-04/msg00129.html
[3] https://sympa.inria.fr/sympa/arc/caml-list/2012-04/msg00134.html



Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.