<?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/11/c347db9f99d8454f53064580a7b15faf"
  from="skaller &lt;skaller@o...&gt;"
  author="skaller"
  date="2003-11-07T08:35:54"
  subject="Re: [Caml-list] Mutually recursive classes"
  prev="2003/11/e3b8f18d6ed983fac7eada29e2dd6c76"
  next="2003/11/20edba130889464de589400be1d0760d"
  prev-in-thread="2003/11/5c281f3bb5dfafa71510a656eb10a809"
  prev-thread="2003/11/927fa5865c499289949ce45512930e10"
  next-thread="2003/11/ef8d11d2a3f4c6fd8183db8286734f46"
  root="../../"
  period="month"
  listname="caml-list"
  title="Archives of the Caml mailing list">

<thread subject="[Caml-list] Mutually recursive classes">
<msg 
  url="2003/11/96c5a045d70b126cf9ebbe6b346fc3dd"
  from="Damien &lt;Damien.Pous@e...&gt;"
  author="Damien"
  date="2003-11-03T10:46:38"
  subject="[Caml-list] Mutually recursive classes">
<msg 
  url="2003/11/5c281f3bb5dfafa71510a656eb10a809"
  from="Didier Remy &lt;remy@m...&gt;"
  author="Didier Remy"
  date="2003-11-03T13:48:46"
  subject="Re: [Caml-list] Mutually recursive classes">
</msg>
<msg 
  url="2003/11/c347db9f99d8454f53064580a7b15faf"
  from="skaller &lt;skaller@o...&gt;"
  author="skaller"
  date="2003-11-07T08:35:54"
  subject="Re: [Caml-list] Mutually recursive classes">
</msg>
</msg>
</thread>

<contents>
On Mon, 2003-11-03 at 21:48, Damien wrote:
&gt; Hello,
&gt; 
&gt; I would like to create two mutually recursive classes,

There is a mechanical workaround for this.

You first parameterise your classes,
then you use a type/class definition
instantiating the parameters: the latter
construction allows recursive 'and's.

For example, 

class type A' ['B'] ..
class type B' ['A'] ..

type A = B A' and B = A B'

[and similarly for classes, using let instead]


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

