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
(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: 2008-08-08 (10:57)
From: Christophe TROESTLER <Christophe.Troestler+ocaml@u...>
Subject: (In)Equality type specialization

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.