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 LAA08078; Mon, 30 Sep 2002 11:44:33 +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 LAA07843 for ; Mon, 30 Sep 2002 11:44:33 +0200 (MET DST) X-SPAM-Warning: Sending machine is listed in blackholes.five-ten-sg.com Received: from athlon.baretta.com (r-mi214-6a130.tin.it [62.211.4.130]) by nez-perce.inria.fr (8.11.1/8.11.1) with ESMTP id g8U9iVD15897 for ; Mon, 30 Sep 2002 11:44:31 +0200 (MET DST) Received: from baretta.com (localhost.localdomain [127.0.0.1]) by athlon.baretta.com (Postfix) with ESMTP id 8C81527249; Mon, 30 Sep 2002 11:54:18 +0200 (CEST) Message-ID: <3D981F4A.8000106@baretta.com> Date: Mon, 30 Sep 2002 11:54:18 +0200 From: Alessandro Baretta Organization: Baretta srl -- www.baretta.com User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.1) Gecko/20020826 X-Accept-Language: it, en MIME-Version: 1.0 To: Michael Vanier Cc: caml-list@inria.fr Subject: Re: [Caml-list] a design problem requiring downcasting? (long) References: <200209260901.g8Q910t03459@orchestra.cs.caltech.edu> <20020927092023.A32079@pauillac.inria.fr> <200209271016.g8RAGYa27211@orchestra.cs.caltech.edu> <3D9785D1.8080608@baretta.com> <200209300709.g8U798C00735@orchestra.cs.caltech.edu> Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk Michael Vanier wrote: > > I'm not sure. All the approaches I've seen in ocaml seem incredibly heavy > compared with RTTI in java (and/or more brittle). I'm not sure about your > approach, though (it looks pretty light). Thanks for the suggestion! You are very welcome ;) > Here is a question for the language designers: is there a technical reason > why RTTI can't be done easily in the ocaml object system? Or is the lack > of RTTI more of a "moral" issue? Or is it just due to not enough time to > put in all the features one would like? I can imagine that the fact that > subtyping is implicit for any class that implements the methods of a > superclass might make RTTI very tricky to implement cleanly in a general > way. I don't think there will be any Caml preachers prophesyzing your doom for having desired RTTI. I just have a feeling it does not fit in cleanly with the type system. > It's too bad we can't all roll our own object systems for ocaml ;-) > > Mike Who says you can't? Pick up CamlP4 and write preprocessing code adding your favorite flavor of RTTI to your your classes. You might very well automate the generation of polymorphic-variant-RTTI-tagging object creation functions--my flavor of RTTI--or any other flavor you like best. One might even come up with a syntax extension supporting some form of double-dispatch polymorphism. But, to my great dishonor, I'm still not a CamlP4 guru, so I'll leave this to others. Alex ------------------- 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