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 BAA10110; Sat, 30 Nov 2002 01:00:26 +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 BAA09371 for ; Sat, 30 Nov 2002 01:00:26 +0100 (MET) Received: from fort-point-station.mit.edu (FORT-POINT-STATION.MIT.EDU [18.7.7.76]) by concorde.inria.fr (8.11.1/8.11.1) with ESMTP id gAU00OX16915 for ; Sat, 30 Nov 2002 01:00:25 +0100 (MET) Received: from central-city-carrier-station.mit.edu (CENTRAL-CITY-CARRIER-STATION.MIT.EDU [18.7.7.72]) by fort-point-station.mit.edu (8.9.2/8.9.2) with ESMTP id TAA19605; Fri, 29 Nov 2002 19:00:23 -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 TAA21697; Fri, 29 Nov 2002 19:00:22 -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 TAA25488; Fri, 29 Nov 2002 19:00:21 -0500 (EST) Date: Fri, 29 Nov 2002 19:00:21 -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: Nicolas Cannasse , caml-list@inria.fr To: Michal Moskal From: Mike Lin In-Reply-To: <20021129172616.GC16911@roke.freak> Message-Id: Content-Transfer-Encoding: 7bit X-Mailer: Apple Mail (2.548) Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk > The problem is what *assembly code* should be generated for function f? > Code to add 2 integers or code to add 2 floats? Hmm.. we'll have a > problem then. Or maybe both? And choose versions of f based on type it > is applied to? But then consider: > > let f x1 x2 ... xn = ((x1 + x1), (x2 + x2), ..., (xn + xn)) > > you need to generate 2^n versions of f. We're getting to ugly things > like C++ templates here. If this is really a problem then what gets generated when you write any polymorphic function at all? The proposal is to allow constrained polymorphism; the polymorphism that is already in OCaml seems to supersede this with regard to the above objection. I wonder if the unification algorithm can be generalized to intersect sets of allowable types instead of unifying "for all" type variables. It doesn't seem too ludicrous in principle but I could easily have missed some nasty corner case. -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