Version française
Home     About     Download     Resources     Contact us    
Browse thread
(In)Equality type specialization
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Christophe TROESTLER <Christophe.Troestler+ocaml@u...>
Subject: (In)Equality type specialization
Hi,

Is a declaration like

external float_eq : float -> float -> bool = "%equal"

considered to be an acceptable way to specialize equality?  Type
annotations do not work in my case because it may be that one passes
[float_eq] as a function argument before evaluating it.  I could of
course define

let float_eq (x:float) y = x = y

but it is slightly less efficient.

So my question is whether I can expect the external declaration to be
robust enough to keep working in future versions of OCaml or whether I
should prefer the second (safe) solution which OCaml compilers will
eventually optimize.

Regards,
C.