Version française
Home     About     Download     Resources     Contact us    

This site is updated infrequently. For up-to-date information, please visit the new OCaml website at

Browse thread
Re: [Caml-list] Re: ocaml sefault in bytecode: unanswered questions
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: 2009-08-09 (13:55)
From: Alain Frisch <alain@f...>
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 
( 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