[Haskell-cafe] Can reallyUnsafePtrEquality give false positives?
Michael Walker
mike at barrucadu.co.uk
Wed Nov 22 17:22:58 UTC 2017
Hello,
Can reallyUnsafePtrEquality give false positives? I can see how it
can give false negatives (eg, compiler optimisations increasing or
decreasing sharing), but I'm not so sure if it can give false
positives.
I don't see how in a garbage collected language two live values could
compare reference equal. Unless the implementation is something like:
reallyUnsafePtrEquality a b = getptr a == getptr b
...as that then means that if the GC moves things after `getptr a` is
evaluated but before `getptr b` is, then you could get a false
positive. But that doesn't seem like a sensible implementation to me,
because then reallyUnsafePtrEquality would surely be totally useless.
--
Michael Walker (http://www.barrucadu.co.uk)
More information about the Haskell-Cafe
mailing list