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 RAA13053; Thu, 26 Sep 2002 17:27:06 +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 RAA13044 for ; Thu, 26 Sep 2002 17:27:06 +0200 (MET DST) Received: from iona.labri.fr (iona.labri.fr [147.210.8.143]) by nez-perce.inria.fr (8.11.1/8.11.1) with ESMTP id g8QFR5D24178 for ; Thu, 26 Sep 2002 17:27:05 +0200 (MET DST) Received: from localhost (localhost.localdomain [127.0.0.1]) by iona.labri.fr (Postfix) with ESMTP id B844B7DA1 for ; Thu, 26 Sep 2002 17:27:01 +0200 (CEST) Received: from serveur4.labri.fr (serveur4.labri.fr [147.210.8.81]) by iona.labri.fr (Postfix) with ESMTP id CD0B47D9D for ; Thu, 26 Sep 2002 17:27:00 +0200 (CEST) Received: (from vanicat@localhost) by serveur4.labri.fr (8.11.6/8.11.6) id g8QFR4j08399; Thu, 26 Sep 2002 17:27:04 +0200 X-Authentication-Warning: serveur4.labri.fr: vanicat set sender to vanicat@labri.u-bordeaux.fr using -f To: caml-list@inria.fr Subject: Re: [Caml-list] a design problem requiring downcasting? (long) References: <200209260901.g8Q910t03459@orchestra.cs.caltech.edu> <3D932579.1839FFF2@noos.fr> From: Remi VANICAT In-Reply-To: <3D932579.1839FFF2@noos.fr> Date: 26 Sep 2002 17:27:04 +0200 Message-ID: User-Agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.2 MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: 8bit X-Virus-Scanned: by AMaViS new-20020517 Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk nadji@noos.fr writes: > Hi, > > If I understood your problem, Jacques Garrigue has shown a way > to allow "safe" downcast, that is to say that if you can't downcast you > cleanly get an exeption. You are required to register your class for > all the downcasts you wants, and it will work only for them (i.e. if > you don't register you can't downcast). This is the "memo" class > in the code below. > Following this idea, your simulation manager has to define all the interfaces it > will be using, and the simulations have to register themselves before > beeing used. > Code follows : > It is what my hweak library is doing. the only difference is that I use my own Hashtbl with weak pointer (so object that are in my memo object can be collected by the GC). -- Rémi Vanicat vanicat@labri.u-bordeaux.fr http://dept-info.labri.u-bordeaux.fr/~vanicat ------------------- 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