[Haskell-cafe] HANSEI in Haskell?
aslatter at gmail.com
Thu Feb 24 23:20:46 CET 2011
On Thu, Feb 24, 2011 at 12:57 PM, Chung-chieh Shan
<ccshan at cs.rutgers.edu> wrote:
> Arnaud Clère <arnaud.clere at free.fr> wrote in article <ik64e9$j6a$1 at dough.gmane.org> in gmane.comp.lang.haskell.cafe:
>> On 24/02/2011 09:30, oleg at okmij.org wrote:
>> > The sort of laziness needed for non-deterministic programming calls
>> > for first-class store. It can be emulated, albeit *imperfectly*,
>> > for example, as was described in the ICFP09 paper.
>> What do you mean by "imperfectly"?
> I think Oleg meant that, because the garbage collector only understands
> the native store and not our emulation of first-class stores, cells of
> a first-class store that are no longer referenced will nevertheless not
> be garbage-collected until the store itself is garbage-collected. What
> we need is a way to tell the garbage collector that the store reference
> and the cell reference are both needed to access the data so the data
> can be garbage-collected as soon as *either* the store reference *or
> the cell reference* is. (Analogy from the capabilities literature:
> the key and the lock are both needed to open the door so the door can
> be garbage-collected as soon as either the key or the lock is.) Any
> thoughts on how to achieve that?
Here's a weak cell which is a candidate for GC as soon as either the
cell or the key is lost:
The implementation is GHC specific, as far as I know.
I don't know if it's exactly what you're looking for, but the idea
could be adapted towards some other purpose.
More information about the Haskell-Cafe