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 BAA00249; Fri, 22 Aug 2003 01:39:25 +0200 (MET DST) 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 BAA32178 for ; Fri, 22 Aug 2003 01:39:24 +0200 (MET DST) Received: from rabelais.socialtools.net (rabelais.socialtools.net [81.2.94.243]) by concorde.inria.fr (8.11.1/8.11.1) with ESMTP id h7LNdAf00621 for ; Fri, 22 Aug 2003 01:39:21 +0200 (MET DST) Received: by rabelais.socialtools.net (Postfix, from userid 108) id 50B9123316; Fri, 22 Aug 2003 00:39:08 +0100 (BST) Received: from socialtools.net (chaucer.socialtools.net [81.2.94.242]) by rabelais.socialtools.net (Postfix) with ESMTP id 3CD2D23315; Fri, 22 Aug 2003 00:39:07 +0100 (BST) Message-ID: <3F455730.2030407@socialtools.net> Date: Fri, 22 Aug 2003 00:35:12 +0100 From: Benjamin Geer User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.4) Gecko/20030624 X-Accept-Language: en-gb, en, fr, it MIME-Version: 1.0 To: Benjamin Geer , "caml-list@inria.fr" Subject: Re: [Caml-list] does class polymorphism need to be so complicated? References: <3F452978.1040805@socialtools.net> In-Reply-To: <3F452978.1040805@socialtools.net> X-Enigmail-Version: 0.76.5.0 X-Enigmail-Supports: pgp-inline, pgp-mime Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Status: No, hits=-2.6 required=5.0 tests=EMAIL_ATTRIBUTION,IN_REP_TO,QUOTED_EMAIL_TEXT,REFERENCES, REPLY_WITH_QUOTES,USER_AGENT_MOZILLA_UA,X_ACCEPT_LANG autolearn=ham version=2.54 X-Spam-Checker-Version: SpamAssassin 2.54 (1.174.2.17-2003-05-11-exp) X-Loop: caml-list@inria.fr X-Spam: no; 0.00; caml-list:01 curiously:01 faq:01 approaches:01 compile:02 string:03 string:03 wrote:03 object:03 object:03 somewhere:04 complicated:04 constraint:05 constraint:05 polymorphism:06 Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk Benjamin Geer wrote: > I'm still curious to know why the example I gave (returning a > mysql_connection from a method that was typed to return a #connection) > didn't compile, though ("This method has type string -> mysql_connection > which is less general than 'a. string -> (#connection as 'a)"). Curiously, it works if the class is parameterised instead of the method: class type ['a] driver = object constraint 'a = #connection method get_connection : db_name:string -> 'a end class mysql_driver = object (self : 's) constraint 's = #connection #driver method get_connection ~(db_name:string) = new mysql_connection db_name end Maybe something about these different approaches should go in a FAQ somewhere. Ben ------------------- 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