Version française
Home     About     Download     Resources     Contact us    
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 http://pauillac.inria.fr/~furuse/thesis/.

Have fun!

Pierre Weis

INRIA, Projet Cristal, Pierre.Weis@inria.fr, http://pauillac.inria.fr/~weis/


-------------------
To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr
Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners