From mboxrd@z Thu Jan 1 00:00:00 1970 Received: (from weis@localhost) by pauillac.inria.fr (8.7.6/8.7.3) id SAA31917 for caml-red; Tue, 21 Nov 2000 18:03:07 +0100 (MET) 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 RAA18457 for ; Tue, 21 Nov 2000 17:49:12 +0100 (MET) Received: from shell5.ba.best.com (shell5.ba.best.com [206.184.139.136]) by nez-perce.inria.fr (8.11.1/8.10.0) with ESMTP id eALGn8929361 for ; Tue, 21 Nov 2000 17:49:09 +0100 (MET) Received: from localhost (bpr@localhost) by shell5.ba.best.com (8.9.3/8.9.2/best.sh) with ESMTP id IAA29610; Tue, 21 Nov 2000 08:49:01 -0800 (PST) Date: Tue, 21 Nov 2000 08:49:00 -0800 (PST) From: Brian Rogoff To: David McClain cc: caml-list@inria.fr Subject: Re: Real excellent object oriented source code examples of Ocaml In-Reply-To: <01e501c05332$9e924470$210148bf@dylan> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: weis@pauillac.inria.fr On Mon, 20 Nov 2000, David McClain wrote: > ... in response to Xavier... > > But as someone who learned to appreciate what CLOS had to offer over the > conventional Smalltalk style of OO, and as an avid user of OCaml, I have to > say that I really miss CLOS sometimes... I'm guessing that what you miss is multiple dispatch, right? That is the distinguishing feature of CLOS with respect to Smalltalk. I hope you aren't talking about the CLOS MOP since I think that would play havoc with static typing. I certainly agree that multiple dispatch has advantages, and some of my own OO Ocaml code relies on uses of the Visitor pattern, which is obviated by the presence of multiple dispatch. If I understood the paper correctly, the "extensional polymorphism" approach which has been discussed here for adding overloading and safe value IO has some similarities with CLOS generic functions but I don't know how it interacts with the object system or polymorphic variants. Maybe Jun or Pierre will comment on this. With regards to the original poster's query, you may wish to direct your colleague to Didier Remy's APPSEM notes, which discuss the object system of Ocaml in detail. If he or you wish to post questions of the form "how to do this with Ocaml objects" here I'm sure someone will help. I know I had a tough time initially working around the lack of downcasting and type querying from Java and C++, but now that I'm a little more proficient I'm convinced that the designers were right not to include them. If the designers wish to improve the current OO system, rather than C++ I'd look to Eiffel for ideas, in particular Eiffel's renaming capabilities. Of course, there is also the (temporary I hope!) lack of polymorphic methods, which correspond to C++ member template functions... Here's the URL for the APPSEM notes: http://cristal.inria.fr/~remy/cours/appsem/ It is true that OO features are less needed in a language like Ocaml, but I for one am sure glad they are there. -- Brian