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 CAA15645; Thu, 21 Aug 2003 02:58:59 +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 CAA25221 for ; Thu, 21 Aug 2003 02:58:57 +0200 (MET DST) Received: from mail.speakeasy.net (mail11.speakeasy.net [216.254.0.211]) by concorde.inria.fr (8.11.1/8.11.1) with ESMTP id h7L0wtf08714 for ; Thu, 21 Aug 2003 02:58:56 +0200 (MET DST) Received: (qmail 15529 invoked from network); 21 Aug 2003 00:58:54 -0000 Received: from unknown (HELO grace.speakeasy.org) ([216.254.0.2]) (envelope-sender ) by mail11.speakeasy.net (qmail-ldap-1.03) with DES-CBC3-SHA encrypted SMTP for ; 21 Aug 2003 00:58:54 -0000 Date: Wed, 20 Aug 2003 17:58:54 -0700 (PDT) From: brogoff@speakeasy.net To: Benjamin Geer cc: "caml-list@inria.fr" Subject: Re: [Caml-list] does class polymorphism need to be so complicated? In-Reply-To: <3F43E250.1040903@socialtools.net> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-Loop: caml-list@inria.fr X-Spam: no; 0.00; brogoff:01 caml-list:01 jacques:01 cuj:99 quux:01 foo:01 baz:01 endline:01 verbosity:01 bool:01 ocaml:01 coerce:01 inherit:01 speakeasy:01 int:01 Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk On Wed, 20 Aug 2003, Benjamin Geer wrote: > brogoff@speakeasy.net wrote: > > If you want to solve your problem, you'll need to coerce, > > [...] > > A solution using polymorphic methods is sketched next, > > These are the two options I described in my original post. Both are > inconvenient. My original questions remain: Sorry, I didn't read your original post, only Brian Hurt's reply to it. Jacques Garrigue explained the reasons why it is hard to do everything you want in OCaml, but I still think you are being a bit harsh. First, calling the methods through functions is not the uncontested evil that you make it out to be. http://www.cuj.com/documents/s=8042/cuj0002meyers/ Second, I don't think that there would be a big gain in productivity by changing the polymorphic method syntax. As JG points out, it's not too much work to ensure that the user of the code doesn't need to use that syntax, as long as the library author is careful, so for instance class virtual processor = object method virtual process : 'a . (#thing as 'a ) -> unit end;; class thing_processor = object inherit processor method process obj = begin obj#quux; print_string (string_of_int (obj#foo 1)); print_string obj#bar; print_string (string_of_bool obj#baz); print_endline "" end end ;; and in any realistic program the virtuals will be in some separate module. Having had a foot in the Ada world, I appreciate this little bit of verbosity in which the typing is all laid out. My problem is not usually the issue of changing text, but the issue of remembering what the types of things are. -- 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