Browse thread
equality operators in OCaml
-
Raj Bandyopadhyay
- Vincent Hanquez
-
Jon Harrop
-
Peng Zang
- Christophe TROESTLER
- Matthew William Cox
-
Peng Zang
[
Home
]
[ Index:
by date
|
by threads
]
[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
| Date: | -- (:) |
| From: | Matthew William Cox <matt@m...> |
| Subject: | Re: [Caml-list] equality operators in OCaml |
On Thu, Jul 24, 2008 at 09:40:36PM -0400, Peng Zang wrote:
> 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.
It's not broken at all, but complient with a common and longstanding
idiom (at least amoung scientists working with numerical codes.) The way
we test for NaN is by comparing to itself, eg:
if x = x then (* x is a number *) else (* x is NaN *)
Matt