Version française
Home     About     Download     Resources     Contact us    
Browse thread
type of ==
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Andreas Rossberg <AndreasRossberg@w...>
Subject: Re: [Caml-list] type of ==
Jon Harrop <jon@ffconsultancy.com>:
>
> If there were an "'a -> 'b -> bool" physical equality test, how could it
ever
> return "true"?

Either when 'a and 'b happen to be instantiated to the same type, or when
the representation happens to be the same, e.g. 0 == false.

The latter also provides a good argument against making physical equality
too polymorphic. It would break abstraction, much worse than it does
already. In particular, a program's meaning could depend on implementation
details (like false being represented by 0) in very questionable ways.

Cheers,

  - Andreas