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 MAA09549; Mon, 30 Sep 2002 12:32:26 +0200 (MET DST) Received: (from weis@localhost) by pauillac.inria.fr (8.7.6/8.7.3) id MAA09451 for caml-list@pauillac.inria.fr; Mon, 30 Sep 2002 12:32:25 +0200 (MET DST) 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 JAA04222 for ; Mon, 30 Sep 2002 09:09:12 +0200 (MET DST) Received: from swordfish.cs.caltech.edu (swordfish.cs.caltech.edu [131.215.44.124]) by nez-perce.inria.fr (8.11.1/8.11.1) with ESMTP id g8U79AD12004 for ; Mon, 30 Sep 2002 09:09:11 +0200 (MET DST) Received: from orchestra.cs.caltech.edu (orchestra.cs.caltech.edu [131.215.44.20]) by swordfish.cs.caltech.edu (Postfix) with ESMTP id A10EBDF263; Mon, 30 Sep 2002 00:09:08 -0700 (PDT) Received: (from mvanier@localhost) by orchestra.cs.caltech.edu (8.11.6/8.9.3) id g8U798C00735; Mon, 30 Sep 2002 00:09:08 -0700 Date: Mon, 30 Sep 2002 00:09:08 -0700 Message-Id: <200209300709.g8U798C00735@orchestra.cs.caltech.edu> X-Authentication-Warning: orchestra.cs.caltech.edu: mvanier set sender to mvanier@cs.caltech.edu using -f From: Michael Vanier To: alex@baretta.com Cc: caml-list@inria.fr In-reply-to: <3D9785D1.8080608@baretta.com> (message from Alessandro Baretta on Mon, 30 Sep 2002 00:59:29 +0200) 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> Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk > Date: Mon, 30 Sep 2002 00:59:29 +0200 > From: Alessandro Baretta > > Michael Vanier wrote: > > > 1) multiple dispatch polymorphism (dispatching on the > types of both obj1 > > and obj2). This is the most elegant approach, but > almost no languages > > support this (I think because it's very hard to > implement efficiently). > > Oh, so what you really need is RTTI, not downcasting, > really. I cannot help you here. I think you need method > overloading for this one, and I doubt you'll get it soon in > O'Caml. I definitely need RTTI. I'm not sure why you think I need method overloading. > > I'm curious about this, so I would be glad if you let me > know what you end up doing. > > Alex > 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! 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. It's too bad we can't all roll our own object systems for ocaml ;-) Mike ------------------- 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