<?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/07/3132c286510f600ffca82535bf00c73b"
  from="Brian Smith &lt;brian-l-smith@u...&gt;"
  author="Brian Smith"
  date="2002-07-15T02:17:45"
  subject="Re: [Caml-list] polymorphic methods"
  prev="2002/07/6c4a835c1b222da5d3b140bc24cc7dbf"
  next="2002/07/9c344668384b0077ed1732712963cb19"
  prev-in-thread="2002/07/6c4a835c1b222da5d3b140bc24cc7dbf"
  next-in-thread="2002/07/c9430e65561feff15e8b94b431ac0365"
  prev-thread="2002/07/51d1044e37baa6970179401f44e15323"
  next-thread="2002/07/1b29cfdfd19552b03e846f44303aa30e"
  root="../../"
  period="month"
  listname="caml-list"
  title="Archives of the Caml mailing list">

<thread subject="[Caml-list] polymorphic methods">
<msg 
  url="2002/07/9d191dbdc8b05bc3b233f36a11ac6504"
  from="nadji@n..."
  author="nadji@n..."
  date="2002-07-14T23:52:07"
  subject="[Caml-list] polymorphic methods">
<msg 
  url="2002/07/6c4a835c1b222da5d3b140bc24cc7dbf"
  from="Jacques Garrigue &lt;garrigue@k...&gt;"
  author="Jacques Garrigue"
  date="2002-07-15T01:05:13"
  subject="Re: [Caml-list] polymorphic methods">
<msg 
  url="2002/07/3132c286510f600ffca82535bf00c73b"
  from="Brian Smith &lt;brian-l-smith@u...&gt;"
  author="Brian Smith"
  date="2002-07-15T02:17:45"
  subject="Re: [Caml-list] polymorphic methods">
</msg>
<msg 
  url="2002/07/c9430e65561feff15e8b94b431ac0365"
  from="nadji@n..."
  author="nadji@n..."
  date="2002-07-15T16:24:31"
  subject="Re: [Caml-list] polymorphic methods">
</msg>
</msg>
</msg>
</thread>

<contents>
Jacques Garrigue wrote:
&gt; 
&gt; Sorry, but there is no handling of instanciation via subtyping.
&gt; Currently subtyping and instanciation are orthogonal concepts: you
&gt; cannot subtype in an .mli, and you cannot instanciate an
&gt; explicitly polymorphic type when subtyping.
&gt; I believe it's correct, but you won't make me write the code without a
&gt; proof :-)

That is really an interesting comment. I wonder, what are people 
currently researching w.r.t. the object-oriented features of O'Caml? 
Besides the above, Jacques said that recursive types with classes is not 
completely defined because (paraphrasing) recursive types are 
polymorphic and recursive classes are monomorphic:

     type variant = Node of node
     and
     class node =
       object
         method as_variant : variant = Node self
       end

I wonder, does a similar problem apply to recursive exceptions and classes?:

     (* email me for a complete example *)
     exception NotFound of node
     and
     class node  =
       object
         method find x = ... else raise (NotFound self)
       end;;

And, similarly, it does seem odd that currently it is impossible to 
create a polymorphic method equivalent to "map" (This type of problem is 
mentioned in http://citeseer.nj.nec.com/remy98objective.html).

Besides polymorphism, I wonder if it is possible to add open classes and 
multiple dispatch to O'Caml like MultiJava does for Java 
(http://www.cs.iastate.edu/~cclifton/multijava/).

I'm just a beginner and I don't know any of the theory of this yet, so 
i'm hoping somebody else will give Jacques some proofs of solutions to 
the above :)

Thanks,
Brian



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

