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] Understanding why Ocaml doesn't support operator overloading.
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Pierre Weis <pierre.weis@i...>
Subject: Re: [Caml-list] Understanding why Ocaml doesn't support operator overloading.
> Of course the ML type system relies on type inference and need do choose the
> "best available" type but what if we enrich the type system with an "OR"
> operator ? Then if (+) is overloaded on floats, you'll get :
> f :  int -> int OR float -> float
> or something like a type constraint :   f : 'a -> 'a where 'a in [int;float]
> This approach seems trivial to me,

To me too: I just needed 5 years to set up and publish the theory and
Jun Furuse needed 6 years only to write a thesis with full proofs.

So you're right, it is indeed trivial.

> but I really can understand that this require a lot of addins in the
> typing algorithms & theory. BTW, does one of the upper approach has
> already been discussed ? any paper on it ? any countersample that
> will make me feel stupid ? :)

Yes, they are papers on it (to start with, read my POPL'95 paper with
François Rouaix and Catherine Dubois). You may also have a look to
Jun's thesis

Have fun!

Pierre Weis

INRIA, Projet Cristal,,

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