Version française
Home     About     Download     Resources     Contact us    
Browse thread
[Caml-list] match on dynamic type
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Olivier Ricordeau <olivier.ricordeau@w...>
Subject: [Caml-list] match on dynamic type
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hi!

I'd like to know how I can make a match on an object's dynamic type. Let
a be an abstract class. Let b and c be two class which inherit from a.
I'd like to write a method which looks like this:

method foo (bar : a) =
    match "a's dynamic type" with
       b -> do_something()
     | c -> do_something_else()

If anyone of you could explain me how to do this... Google didn't really
help me about this, and I didn't find the answer (which is quite rare :)
) in the O'Reilly book.

Cheers

- --
- -= *Olivier RICORDEAU* =-        http://freefolks.org
          < LibNN addict http://libnn.org >
lynx -source http://freefolks.org/key.asc | gpg --import
olivier.ricordeau@wanadoo.fr _Might the source be with you_
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.2 (GNU/Linux)

iD8DBQE/HV2lDFRYKP6DJEwRAp+uAKCmOsWZT10GrNvuJxd1NFte4mmBfACdHrTC
0IBIrPJscI5kZHwqw1+gx2Q=
=MVAg
-----END PGP SIGNATURE-----

-------------------
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