Getting started

Tibor Simko tibor.simko at
Tue Sep 24 10:50:03 EDT 2002


On Mon, 23 Sep 2002, Alex Martelli wrote:
> as far as I know, the CAML dialect of ML (also in the O'Caml
> extension, last I looked) is one of the very few programming
> languages that doesn't have a polymorphic + operator -- you have to
> use + for integers only, +. for floating-point. 

There is a good reason why OCaml does not overload the + operator:
type inferring.  In OCaml you do not need to declare variables
explicitly in the program because OCaml infers types for you.
However, this does not match well with operator overloading, since the
compiler would not understand whether "a + b" stands for float or
integer.  Unlike SML, OCaml decided to avoid this kind of type
inferring problem by not overloading the + operator.



More information about the Python-list mailing list