Version française
Home     About     Download     Resources     Contact us    
Browse thread
equality operators in OCaml
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Peng Zang <peng.zang@g...>
Subject: Re: [Caml-list] equality operators in OCaml
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1


On Thursday 24 July 2008 06:32:36 pm Jon Harrop wrote:
> From: "Raj Bandyopadhyay" <rajb@rice.edu>
>
> > Hi OCaml folk
> >
> > I apologize if I've been asking too many questions on this list recently,
> > but I'm working on a heavy OCaml application and need help sometimes.
> >
> > I am having a disagreement with a colleague about how the equality
> > operators in OCaml work and am trying to resolve it conclusively.
> >
> > 1) I understand that the '==' operator is basically a pointer comparison
> > i.e. a==b true  iff a and b are the same entity. Is this true?
>
> There are some complications here. Firstly, NaN has multiple
> representations that may or may not be physically equal but is always
> structurally unequal to itself.


Yeah, that always seemed broken to me.  If two things are physically equal 
(they occupy the same memory space) it doesn't make sense for them to be 
structurally unequal (contain different content).  Personally, one of the 
first things I did is redefined (=) to fix this.

Peng
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.7 (GNU/Linux)

iD8DBQFIiS8YfIRcEFL/JewRAnXqAKCAhHWGTHe6z58jRplmMmnNFgljUACfUhaJ
SQSWrxxpPpHqiJcFBcNlVsM=
=af4P
-----END PGP SIGNATURE-----