
22 Jun
2004
22 Jun
'04
9:26 a.m.
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. :-) -Jan