Browse thread
[Caml-list] a design problem requiring downcasting? (long)
[
Home
]
[ Index:
by date
|
by threads
]
[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
| Date: | -- (:) |
| From: | Remi VANICAT <vanicat@l...> |
| Subject: | Re: [Caml-list] a design problem requiring downcasting? (long) |
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