RE: [Haskell-cafe] Ord (IORef a)?

23 Jun
2004
23 Jun
'04
5:48 a.m.
On 23 June 2004 03:53, John Meacham wrote:
Yeah, i forgot about the GC moving things around. actually, if the GC could be coaxed to move things around, but never change the relative order of IORefs (like a compacting collector), then the address could still be used for Ord and Eq.
This is a rather restrictive global invariant, I don't think it's practical.
how is Eq implemented such that the GC doesn't move one side after you read the address of the other?
The sameMutVar# primitive is atomic with respect to the GC. It ought to be possible to implement Ord on IORef using StablePtr, but for some reason StablePtr isn't an instance of Ord. Cheers, Simon
7636
Age (days ago)
7636
Last active (days ago)
0 comments
1 participants
participants (1)
-
Simon Marlow