[Haskell-cafe] number of references to a variable

wren ng thornton wren at freegeek.org
Sun Nov 2 14:23:57 EST 2008


Andrew Coppin wrote:
> Jan-Willem Maessen wrote:
> > Usually the clever thing you want to know is "this is the sole 
> > reference to the pointed-to object".
> 
> Does GHC have weak references? (I seem to recall it does...)


http://www.haskell.org/ghc/docs/latest/html/libraries/base/System-Mem-Weak.html


As for the uniqueness of a reference to an object, there are 
alternatives to reference-counting techniques. For example, the language 
Clean[1] builds it into the type system (to replace monads) and they've 
gotten very good performance results from doing so. There are other 
linear logic approaches as well, though porting any of these to Haskell 
would take a fair deal of work to make efficient. Certainly a worthy 
research goal, but probably not what you had in mind :)

[1] <http://clean.cs.ru.nl/>

-- 
Live well,
~wren


More information about the Haskell-Cafe mailing list