[Haskell-cafe] Garbage collection as a dual of laziness?

John Meacham john at repetae.net
Mon Nov 24 17:50:22 EST 2008


A way this analogy breaks down is that lazyness evaluates precisely what
is needed, and no more. The set of values evaluated by lazyness is
exactly equivalent to the set of values needed.

Garbage collectors are conservative by nature, the values collected by
the garbage collector are some subset of the values that will not be
needed in the future, which particular subset that is depends on details
of the garbage collector and the optimizer.

Also, there is no real direct way to "observe" _when_ values have been garbage
collected (without resorting to weak pointers or implementation details)
so it is questionable what a correspondence will give you practically in
terms of reasoning ability. Whether the garbage was 'collected' right
away or when needed, as long as you don't run out of memory the program
is oblivious to it.

        John



-- 
John Meacham - ⑆repetae.net⑆john⑈


More information about the Haskell-Cafe mailing list