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 (16:34)
From: brogoff@s...
Subject: Re: [Caml-list] Why are arithmetic functions not polymorph?
On Fri, 23 May 2003, David Monniaux wrote:
[... nice explanations snipped ...]
> - short of a significant change in the type system, +, -, *, / would not
>   refuse non-arithmetic operands, but would throw exceptions at runtime if
>   applied to non-arithmetic arguments.

GCaml, which will be resurrected after 3.07 is released, is just such an 
extension to the type system. It would also allow using + for string 
concatenation, or using the arithmentic operators for set operations. 

Given the ability to control syntax, it would also enable one to use array 
syntax to access hash tables or maps, or string accesses. I believe that the
desire to do this was discussed some time ago in the context of extensional 
polymorphism (i.e., GCaml generics) but the syntactic issue was ignored. 

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

-- Brian

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