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 SAA06347; Wed, 20 Aug 2003 18:05:41 +0200 (MET DST) 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 SAA13371 for ; Wed, 20 Aug 2003 18:05:39 +0200 (MET DST) Received: from epexch01.qlogic.org ([63.170.40.3]) by concorde.inria.fr (8.11.1/8.11.1) with ESMTP id h7KG5cf25271 for ; Wed, 20 Aug 2003 18:05:39 +0200 (MET DST) Received: from epmailtmp.qlogic.org ([10.20.33.254]) by epexch01.qlogic.org with Microsoft SMTPSVC(5.0.2195.5329); Wed, 20 Aug 2003 11:05:43 -0500 Received: from eagle.ancor.com ([10.20.33.146]) by epmailtmp.qlogic.org with Microsoft SMTPSVC(5.0.2195.4905); Wed, 20 Aug 2003 11:05:34 -0500 Received: from localhost (bhurt@localhost) by eagle.ancor.com (8.11.6/8.11.6) with ESMTP id h7KG5ZY16749; Wed, 20 Aug 2003 11:05:35 -0500 X-Authentication-Warning: eagle.ancor.com: bhurt owned process doing -bs Date: Wed, 20 Aug 2003 11:05:35 -0500 (CDT) From: Brian Hurt X-X-Sender: To: Benjamin Geer cc: Subject: Re: [Caml-list] does class polymorphism need to be so complicated? In-Reply-To: <3F4396F6.1010404@socialtools.net> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-OriginalArrivalTime: 20 Aug 2003 16:05:34.0740 (UTC) FILETIME=[E3634540:01C36734] X-Loop: caml-list@inria.fr X-Spam: no; 0.00; caml-list:01 unit-:01 upcast:01 coercion:01 declaring:01 unit:03 wrote:03 obj:03 object:03 complicated:04 aug:05 polymorphism:06 brian:06 benjamin:07 function:09 Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk On Wed, 20 Aug 2003, Benjamin Geer wrote: > class printer = > object > method print (obj : printable) = obj#print() > end ;; Instead of declaring obj to be printable, why not just declare that it has a function print? Like: class printer = object method print (obj: unit>) = obj#print (); end;; This removes the need for a coercion, as it gets around the need to upcast. Brian ------------------- 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