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 JAA32170; Fri, 27 Sep 2002 09:20:28 +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 JAA32161 for ; Fri, 27 Sep 2002 09:20:27 +0200 (MET DST) Received: from pauillac.inria.fr (pauillac.inria.fr [128.93.11.35]) by concorde.inria.fr (8.11.1/8.11.1) with ESMTP id g8R7KN524626; Fri, 27 Sep 2002 09:20:24 +0200 (MET DST) Received: (from fpottier@localhost) by pauillac.inria.fr (8.7.6/8.7.3) id JAA32159; Fri, 27 Sep 2002 09:20:23 +0200 (MET DST) Date: Fri, 27 Sep 2002 09:20:23 +0200 From: Francois Pottier To: Michael Vanier Cc: caml-list@inria.fr Subject: Re: [Caml-list] a design problem requiring downcasting? (long) Message-ID: <20020927092023.A32079@pauillac.inria.fr> Reply-To: Francois.Pottier@inria.fr References: <200209260901.g8Q910t03459@orchestra.cs.caltech.edu> Mime-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: 8bit X-Mailer: Mutt 1.0i In-Reply-To: <200209260901.g8Q910t03459@orchestra.cs.caltech.edu>; from mvanier@cs.caltech.edu on Thu, Sep 26, 2002 at 02:01:00AM -0700 Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk Hi, > With alternative (1), to do the method call above you would need downcasting > e.g. in pseudo-ocaml: > > let obj1 = array.(0) as class1 in > let obj2 = array.(1) as class2 in > obj1#my_method obj2 > > with the cast raising an exception if it fails. No problem. There is something you haven't explained here. How, given the array indices 0 and 1, do you know that the appropriate classes are class1 and class2? How do map from an index back to the expected class? If we knew this, perhaps we would able to give better advice. -- François Pottier Francois.Pottier@inria.fr http://pauillac.inria.fr/~fpottier/ ------------------- 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