[Haskell-cafe] Ord (IORef a)?

Jan-Willem Maessen - Sun Labs East Janwillem.Maessen at Sun.COM
Tue Jun 22 09:26:09 EDT 2004

Simon Peyton-Jones wrote:
> ...
> There is an efficiency cost though.  Each IORef would need to have an
> extra field, to record its allocation ID.  (Address is not enough -- the
> garbage collector can mangle them.)   
> My own view is that this is fine -- IORefs shouldn't be in your inner
> loop, so an extra word in each is no big deal.   Unless there are views
> to the contrary, I'd be happy to see this in GHC.

It's worth noting at this point that the Java world has developed a 
nice, big bag of tricks for language implementors to use to solve 
exactly this problem.  Somehow, they make it work even for the stuff 
which *is* in the inner loop. :-)


More information about the Haskell-Cafe mailing list