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] Why are arithmetic functions not polymorph?
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: 2003-05-23 (20:25)
From: brogoff@s...
Subject: Re: [Caml-list] Why are arithmetic functions not polymorph?
On Fri, 23 May 2003, Brian Hurt wrote:
> On Fri, 23 May 2003 wrote:
> > > SML has a kind of operator overloading, but I don't know the details.
> > 
> > SML doesn't allow the user to define overloadings, and that is an 
> > abomination. Java is similarly abominable. 
> > 
> Ocaml allows you to define *new* operators to your heart's content.  You
> just can't overload the meanings of old operators.

I understand the difference between operator redefinition, which OCaml and 
SML have, and user defined overloading, which neither has, but which can be 
found in Haskell and Clean (sort of, through type classes) and C++ and Ada. 

I actually think overloading can be *really* *really* good. The problem, or 
rather, one of the many problems, with C++ IMO is that it has overloading and 
implicit conversions of types. That's a bad combination. 

One nice thing about GCaml is that it shouldn't bother people like you who 
dislike overloading. The overloading is fairly explicit and closed world. 
It gracefully handles the most important, very simple cases, and sneaks 
in the ability to type a much wider range of functions than can be typed now. 
You should at least take a look at the README in the prototype to get an idea of 
what I mean here. 

New operators are not sufficient, and SML is more powerful in it's ability to 
define new operators than OCaml (minus CamlP4) is. 

-- Brian

To unsubscribe, mail Archives:
Bug reports: FAQ:
Beginner's list: