From: Olivier Ricordeau <olivier.ricordeau@wanadoo.fr>
To: caml-list@inria.fr
Subject: [Caml-list] match on dynamic type
Date: Tue, 22 Jul 2003 17:52:06 +0200 [thread overview]
Message-ID: <3F1D5DA6.7090602@wanadoo.fr> (raw)
-----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
next reply other threads:[~2003-07-22 15:52 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2003-07-22 15:52 Olivier Ricordeau [this message]
2003-07-22 16:26 ` Olivier Ricordeau
2003-07-22 17:45 ` Olivier Ricordeau
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=3F1D5DA6.7090602@wanadoo.fr \
--to=olivier.ricordeau@wanadoo.fr \
--cc=caml-list@inria.fr \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox