<?xml version="1.0" encoding="ISO-8859-1"?>

<!DOCTYPE message PUBLIC
  "-//MLarc//DTD MLarc output files//EN"
  "../../mlarc.dtd"[
  <!ATTLIST message
    listname CDATA #REQUIRED
    title CDATA #REQUIRED
  >
]>

  <?xml-stylesheet href="../../mlarc.xsl" type="text/xsl"?>


<message 
  url="2003/07/f4f0c2155e99d8e24366c19287802309"
  from="Olivier Ricordeau &lt;olivier.ricordeau@w...&gt;"
  author="Olivier Ricordeau"
  date="2003-07-22T15:52:09"
  subject="[Caml-list] match on dynamic type"
  prev="2003/07/bfc407e07222d7f3eb199fe58b855f66"
  next="2003/07/8d172d820e65f0b1a595f47107efe83b"
  next-in-thread="2003/07/8d172d820e65f0b1a595f47107efe83b"
  prev-thread="2003/07/efc650f6736621d6f758bb8de52b1496"
  next-thread="2003/07/7347ef3d79f516ef8692babe85c8791a"
  root="../../"
  period="month"
  listname="caml-list"
  title="Archives of the Caml mailing list">

<thread subject="[Caml-list] match on dynamic type">
<msg 
  url="2003/07/f4f0c2155e99d8e24366c19287802309"
  from="Olivier Ricordeau &lt;olivier.ricordeau@w...&gt;"
  author="Olivier Ricordeau"
  date="2003-07-22T15:52:09"
  subject="[Caml-list] match on dynamic type">
<msg 
  url="2003/07/8d172d820e65f0b1a595f47107efe83b"
  from="Olivier Ricordeau &lt;olivier.ricordeau@w...&gt;"
  author="Olivier Ricordeau"
  date="2003-07-22T16:26:59"
  subject="Re: [Caml-list] match on dynamic type">
<msg 
  url="2003/07/2d76bfee0b5a11a7db9f49191f910099"
  from="Olivier Ricordeau &lt;olivier.ricordeau@w...&gt;"
  author="Olivier Ricordeau"
  date="2003-07-22T17:45:32"
  subject="Re: [Caml-list] match on dynamic type">
</msg>
</msg>
</msg>
</thread>

<contents>
-----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 -&gt; do_something()
     | c -&gt; 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
          &lt; LibNN addict http://libnn.org &gt;
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

</contents>

</message>

