<?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="2002/12/40d47b1fdb99fb42dfd9ca964f446527"
  from="Olivier Andrieu &lt;andrieu@i...&gt;"
  author="Olivier Andrieu"
  date="2002-12-09T14:10:35"
  subject="Re: [Caml-list] How to throw away oop?"
  prev="2002/12/5f28c0d6c5868bcafd8e8dd4e701f0b3"
  next="2002/12/4456fccbbadad6cb7c7b36cf182fe3aa"
  prev-in-thread="2002/12/5f28c0d6c5868bcafd8e8dd4e701f0b3"
  next-in-thread="2002/12/4456fccbbadad6cb7c7b36cf182fe3aa"
  prev-thread="2002/12/8ea889634a390e77255fa06015627be4"
  next-thread="2002/12/4f26c91200b871153ac571f4e71c7d1f"
  root="../../"
  period="month"
  listname="caml-list"
  title="Archives of the Caml mailing list">

<thread subject="[Caml-list] How to throw away oop?">
<msg 
  url="2002/12/5f28c0d6c5868bcafd8e8dd4e701f0b3"
  from="onlyclimb &lt;onlyclimb@1...&gt;"
  author="onlyclimb"
  date="2002-12-09T13:21:02"
  subject="[Caml-list] How to throw away oop?">
<msg 
  url="2002/12/40d47b1fdb99fb42dfd9ca964f446527"
  from="Olivier Andrieu &lt;andrieu@i...&gt;"
  author="Olivier Andrieu"
  date="2002-12-09T14:10:35"
  subject="Re: [Caml-list] How to throw away oop?">
<msg 
  url="2002/12/4456fccbbadad6cb7c7b36cf182fe3aa"
  from="brogoff@s..."
  author="brogoff@s..."
  date="2002-12-09T18:44:06"
  subject="Re: [Caml-list] How to throw away oop?">
</msg>
</msg>
<msg 
  url="2002/12/b35f796e88ae22506184f5b230eccf45"
  from="Didier Le Botlan &lt;lebotlan@b...&gt;"
  author="Didier Le Botlan"
  date="2002-12-09T21:17:12"
  subject="Re: [Caml-list] How to throw away oop?">
</msg>
</msg>
</thread>

<contents>
 onlyclimb [Monday 9 December 2002] :
 &gt;   DNA and Protein can be a subclass of Seq. And in fact there are many 
 &gt;  kind of sequences , so we can suppose the number of the kind of Seq is 
 &gt; infinite. ie. the subclasses of Seq can be infinite.  and DNA and 
 &gt; Protein are just two of them

Do you really think you'll have to subclass your Seq often ? I mean,
you have DNA, proteins and this is it (you can add RNA if you want to
nitpick). In this case, ie when your datatypes are fixed and you're not
going to extend them, you can simply use a variant type.

module DNA = 
  type t = ...
  let length = ...
end

module Protein = 
  type t = ...
  let length = ...
end

and you can build a generic module for functions common in DNA and
Protein :

module Seq = 
  type t = 
   | DNA of DNA.t
   | Protein of Protein.t
  let length = function
   | DNA s -&gt; DNA.length s
   | Protein s -&gt; Protein.length s
end

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

