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 AAA30941; Sun, 1 Dec 2002 00:06:51 +0100 (MET) X-Authentication-Warning: pauillac.inria.fr: majordomo set sender to owner-caml-list@pauillac.inria.fr using -f Received: from nez-perce.inria.fr (nez-perce.inria.fr [192.93.2.78]) by pauillac.inria.fr (8.7.6/8.7.3) with ESMTP id AAA30325 for ; Sun, 1 Dec 2002 00:06:50 +0100 (MET) Received: from pacific-carrier-annex.mit.edu (PACIFIC-CARRIER-ANNEX.MIT.EDU [18.7.21.83]) by nez-perce.inria.fr (8.11.1/8.11.1) with ESMTP id gAUN6n119486 for ; Sun, 1 Dec 2002 00:06:50 +0100 (MET) Received: from central-city-carrier-station.mit.edu (CENTRAL-CITY-CARRIER-STATION.MIT.EDU [18.7.7.72]) by pacific-carrier-annex.mit.edu (8.9.2/8.9.2) with ESMTP id SAA02708; Sat, 30 Nov 2002 18:06:48 -0500 (EST) Received: from melbourne-city-street.mit.edu (MELBOURNE-CITY-STREET.MIT.EDU [18.7.21.86]) by central-city-carrier-station.mit.edu (8.9.2/8.9.2) with ESMTP id SAA20178; Sat, 30 Nov 2002 18:06:48 -0500 (EST) Received: from mit.edu (bgp569226bgs.eatntn01.nj.comcast.net [68.38.250.46]) by melbourne-city-street.mit.edu (8.9.2/8.9.2) with ESMTP id SAA01503; Sat, 30 Nov 2002 18:06:47 -0500 (EST) Date: Sat, 30 Nov 2002 18:06:44 -0500 Subject: Re: [Caml-list] Understanding why Ocaml doesn't support operator overloading. Content-Type: text/plain; charset=US-ASCII; format=flowed Mime-Version: 1.0 (Apple Message framework v548) Cc: caml-list@inria.fr To: Michal Moskal From: Mike Lin In-Reply-To: <20021130102400.GA2705@roke.freak> Message-Id: <653C1EDB-04B8-11D7-89AB-000393AE4242@mit.edu> Content-Transfer-Encoding: 7bit X-Mailer: Apple Mail (2.548) Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk > > No. Compiler trates polymorphic types as abstract then. It need not > know > what is the exact type, all it cares about is size of data, which in > case of OCaml on 32 bit machines is always 4 bytes. > > For example in: > ....... Fair enough. I'm curious though: Say I'm the programmer and I would like to solve the problem of combining different types of numbers with a fairly uniform syntax. I'm either going to define a union type for numbers and have all my functions pattern-match, or else I'm going to write several versions of my functions to handle different types of numbers and call different ones as appropriate. I would wish that if all my functions were built up from the primitives +, -, *, /, etc. the compiler could do this for me. The compiler may have to generate many different versions if I use them all, but otherwise I would have to write them myself! I don't think this whole thing is a good idea in general, but I don't buy this practicality/efficiency argument against it. > > Again: Haskell does it, so typing isn't real issue here. Haskell also does not have mutable data, and I think it has been well established in the literature that mutable data complicates subtyping and intersection typing. So, as others are pointing out, I definitely think typing is a real issue here. -Mike ------------------- 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