<?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/e85ce98c80b46bc247f9dbfe9e5f0e10"
  from="Brian Hurt &lt;brian.hurt@q...&gt;"
  author="Brian Hurt"
  date="2003-07-22T22:35:48"
  subject="Re: [Caml-list] Variant parameterized method?"
  prev="2003/07/2ad4fe2fc6657cf9aca64ef6fda489ec"
  next="2003/07/ac1c2c8aca7cd5fb3b971997abf519d8"
  prev-in-thread="2003/07/2ad4fe2fc6657cf9aca64ef6fda489ec"
  prev-thread="2003/07/f4f0c2155e99d8e24366c19287802309"
  next-thread="2003/07/29d3d4246f320c31566fbe65671742e3"
  root="../../"
  period="month"
  listname="caml-list"
  title="Archives of the Caml mailing list">

<thread subject="[Caml-list] Variant parameterized method?">
<msg 
  url="2003/07/7347ef3d79f516ef8692babe85c8791a"
  from="Brian Hurt &lt;brian.hurt@q...&gt;"
  author="Brian Hurt"
  date="2003-07-22T20:11:01"
  subject="[Caml-list] Variant parameterized method?">
<msg 
  url="2003/07/2ad4fe2fc6657cf9aca64ef6fda489ec"
  from="Jacques Garrigue &lt;garrigue@k...&gt;"
  author="Jacques Garrigue"
  date="2003-07-22T22:06:49"
  subject="Re: [Caml-list] Variant parameterized method?">
<msg 
  url="2003/07/e85ce98c80b46bc247f9dbfe9e5f0e10"
  from="Brian Hurt &lt;brian.hurt@q...&gt;"
  author="Brian Hurt"
  date="2003-07-22T22:35:48"
  subject="Re: [Caml-list] Variant parameterized method?">
</msg>
</msg>
</msg>
</thread>

<contents>
Thanks for your help.

On Wed, 23 Jul 2003, Jacques Garrigue wrote:

&gt; This precise type is not admissible in the ocaml type system.
&gt; In ocaml recursive types must be regular: only 'a foo may occur in the
&gt; expansion of 'a foo.

Ah.  Any hope of getting this fixed?

&gt; 
&gt; This problem is discussed in an answer to PR#1730 in the caml bug
&gt; database.

Unfortunately, I don't speak french.

&gt; This can be solved by introducing an explicit wrapper.

This is one possibility.

&gt; If you think (as I do) that all these examples are just too
&gt; complicated in practice, there is a simpler way to go:
&gt; only define a fold method in your class, and define map itself out of
&gt; the class.

Maybe I'm asking the wrong question.  I need/want map to behave 
differently when called on different subtypes of foo.  In a pseudo 
java/ocaml mix, I want to do:

let map f x =
    if x instanceof 'a foo_map then
        let e = ('a foo_map) in
        (* various code dealing with an already mapped foo *)
    else
        (* various code dealing with an arbitrary unmapped foo *)

The obvious way to do this to me is to make map a member function.  But 
this wouldn't be the first time I was missing something obvious.

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>

