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 JAA30884; Fri, 22 Aug 2003 09:17:00 +0200 (MET DST) 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 JAA30344 for ; Fri, 22 Aug 2003 09:16:58 +0200 (MET DST) Received: from rabelais.socialtools.net (rabelais.socialtools.net [81.2.94.243]) by nez-perce.inria.fr (8.11.1/8.11.1) with ESMTP id h7M7GwT04646 for ; Fri, 22 Aug 2003 09:16:58 +0200 (MET DST) Received: by rabelais.socialtools.net (Postfix, from userid 108) id 77F6E23315; Fri, 22 Aug 2003 08:16:57 +0100 (BST) Received: from socialtools.net (chaucer.socialtools.net [81.2.94.242]) by rabelais.socialtools.net (Postfix) with ESMTP id 1F0FC23314; Fri, 22 Aug 2003 08:16:54 +0100 (BST) Message-ID: <3F45C27B.4080806@socialtools.net> Date: Fri, 22 Aug 2003 08:12:59 +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: Jacques Garrigue Cc: caml-list@inria.fr Subject: Re: [Caml-list] does class polymorphism need to be so complicated? References: <3F452978.1040805@socialtools.net> <3F455730.2030407@socialtools.net> <20030822125953S.garrigue@kurims.kyoto-u.ac.jp> In-Reply-To: <20030822125953S.garrigue@kurims.kyoto-u.ac.jp> 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 jacques:01 coercions:01 coercions:01 garrigue:01 polymorphic:01 wrote:03 interface:03 object:03 types:03 types:03 explanation:04 arrow:95 complicated:04 polymorphism:06 Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk Jacques Garrigue wrote: > Because #connection is _not_ an interface. It is just a polymorphic > type including all types having more methods than connection. > So returning a #connection means that the returned object already has > all the methods in the world, with all types imaginable. Nonsense. > > #connection only makes sense on the left-hand side of an arrow. Thanks for this explanation. It shows very clearly the advantage of using the approach involving coercions: with coercions, a method can return an instance of the base class, so factory methods become possible. 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