[Haskell-cafe] pointer equality

Carl Howells chowells at janrain.com
Wed Jul 20 08:33:58 CEST 2011


On Tue, Jul 19, 2011 at 11:14 PM, yi huang <yi.codeplayer at gmail.com> wrote:
> 2011/7/20 Eugene Kirpichov <ekirpichov at gmail.com>
>>
>> reallyUnsafePointerEq#, and it really is as unsafe as it sounds :)
>>
> Why is it so unsafe? i can't find any documentation on it.
> I think always compare pointer first is a good optimization.

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.

I'm not aware of any use case that's resilient to both failure modes, offhand.

Carl



More information about the Haskell-Cafe mailing list