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
[Caml-list] About overloading( + +. and <)
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Jean-Christophe Filliatre <Jean-Christophe.Filliatre@l...>
Subject: Re: [Caml-list] About overloading( + +. and <)

temofey writes:
 > But compare operators like "<", ">" is the same for Integer, Float,
 > String. Are they overload? Is this contradiction in terms?

=, < and > are not overloaded, but polymorphic. It means they can be
applied to any two values of the same type, for any type (base types
but also user defined types like tuples, records, recursive 
types, etc.) except functional types (on which we don't know how to
compare values). You may have a look at
byterun/compare.c in ocaml sources to see how this comparison is defined.

It couldn't be the same for arithmetic operations (plus, minus, etc)
because we don't know how to define them on types other than int and

Jean-Christophe Filliatre
Bug reports:  FAQ:
To unsubscribe, mail  Archives: