From mboxrd@z Thu Jan 1 00:00:00 1970 Received: (from majordomo@localhost) by pauillac.inria.fr (8.7.6/8.7.3) id WAA28881; Sat, 30 Nov 2002 22:33:22 +0100 (MET) X-Authentication-Warning: pauillac.inria.fr: majordomo set sender to owner-caml-list@pauillac.inria.fr using -f Received: from concorde.inria.fr (concorde.inria.fr [192.93.2.39]) by pauillac.inria.fr (8.7.6/8.7.3) with ESMTP id WAA28765 for ; Sat, 30 Nov 2002 22:33:22 +0100 (MET) Received: from pauillac.inria.fr (pauillac.inria.fr [128.93.11.35]) by concorde.inria.fr (8.11.1/8.11.1) with ESMTP id gAULXKX08831; Sat, 30 Nov 2002 22:33:20 +0100 (MET) Received: (from weis@localhost) by pauillac.inria.fr (8.7.6/8.7.3) id WAA28914; Sat, 30 Nov 2002 22:33:20 +0100 (MET) From: Pierre Weis Message-Id: <200211302133.WAA28914@pauillac.inria.fr> Subject: Re: [Caml-list] Understanding why Ocaml doesn't support operator overloading. In-Reply-To: <001c01c297bf$436b7a20$4600a8c0@warp> from Nicolas Cannasse at "Nov 29, 102 04:52:03 pm" To: warplayer@free.fr (Nicolas Cannasse) Date: Sat, 30 Nov 2002 22:33:19 +0100 (MET) Cc: xavier.leroy@inria.fr, jhf@hex.no, caml-list@inria.fr X-Mailer: ELM [version 2.4ME+ PL28 (25)] MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8bit Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk [...] > 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