Browse thread
Re: [Caml-list] Re: ocaml sefault in bytecode: unanswered questions
[
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: | ivan chollet <ivan.chollet@f...> |
| Subject: | RE: [Caml-list] Re: ocaml sefault in bytecode: unanswered questions |
Cool, thanks for that, for some reason this wasn't obvious to me reading the documentation. -----Original Message----- From: Alain Frisch [mailto:alain@frisch.fr] Sent: dimanche 9 août 2009 15:55 To: ivan chollet Cc: caml-list@yquem.inria.fr Subject: Re: [Caml-list] Re: ocaml sefault in bytecode: unanswered questions On 8/9/2009 2:06 PM, ivan chollet wrote: > I would have thought physical equality implies structural equality, but > it doesn’t seem like it. > > Can you please explain to me what’s wrong there? There are two modes for the generic comparison. The total mode (Pervasives.compare) creates a total ordering between values (except for functional values and custom blocks with no comparison function) and uses physical equality as a shortcut to cut the recursive traversal of sub-values. The non-total mode (used by the operators = < > <= >=) has a different behavior for NaN values ([nan <= x], [x <= nan], and [nan = x] all return false, including when x is nan) and does not use the physical equality shortcut (so that [let x = (nan, nan) in x = x] returns false). -- Alain