
On Tue, 2011-07-19 at 23:33 -0700, Carl Howells wrote:
False positives and false negatives are both possible, depending on GC timing. Don't use it, unless you know why it can result in both false positives and false negatives, and you know why neither of those are bad for your use case.
Can you clarify what you mean by false positives? Do you just mean it may return true but then later behave as if there's no sharing? Or do you mean it may return true and then later the two expressions may be observably different? If the latter, then it seems this would be a pretty serious garbage collector bug, and that it would be impossible that such a bug wouldn't also break other code that doesn't use pointer equality at all. After all, we've got a running user thread, which if it were to force those thunks now they would necessarily be observably equal, but if it doesn't and waits until later they may be different? In any case, the name is still silly. unsafeCoerce and unsafePerformIO can both lead to RTS crashes... but we seem to be saying they aren't as unsafe as this one? Right. -- Chris Smith