caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
* [Caml-list] About overloading( + +. and <)
@ 2001-07-02 17:07 temofey
  2001-07-03  7:29 ` Jean-Christophe Filliatre
  0 siblings, 1 reply; 2+ messages in thread
From: temofey @ 2001-07-02 17:07 UTC (permalink / raw)
  To: caml-list

Hello

In O'Caml not present overloading. Because operators like "plus",
"minus", "divide" and "multiple" is separate for Integers and Float.
For Int they are "+","-","*" and "/", and for Float they are "+.",
"-.", "*." and "/.".
But compare operators like "<", ">" is the same for Integer, Float,
String. Are they overload? Is this contradiction in terms?

-- 
temofey
temofey@sit.kiev.ua


-------------------
Bug reports: http://caml.inria.fr/bin/caml-bugs  FAQ: http://caml.inria.fr/FAQ/
To unsubscribe, mail caml-list-request@inria.fr  Archives: http://caml.inria.fr


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [Caml-list] About overloading( + +. and <)
  2001-07-02 17:07 [Caml-list] About overloading( + +. and <) temofey
@ 2001-07-03  7:29 ` Jean-Christophe Filliatre
  0 siblings, 0 replies; 2+ messages in thread
From: Jean-Christophe Filliatre @ 2001-07-03  7:29 UTC (permalink / raw)
  To: temofey; +Cc: caml-list


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
float.

-- 
Jean-Christophe Filliatre
  mailto:Jean-Christophe.Filliatre@lri.fr
  http://www.lri.fr/~filliatr
-------------------
Bug reports: http://caml.inria.fr/bin/caml-bugs  FAQ: http://caml.inria.fr/FAQ/
To unsubscribe, mail caml-list-request@inria.fr  Archives: http://caml.inria.fr


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2001-07-03  7:30 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2001-07-02 17:07 [Caml-list] About overloading( + +. and <) temofey
2001-07-03  7:29 ` Jean-Christophe Filliatre

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).