From: Brian Hurt <brian.hurt@qlogic.com>
To: Jacques Garrigue <garrigue@kurims.kyoto-u.ac.jp>
Cc: Ocaml Mailing List <caml-list@inria.fr>
Subject: Re: [Caml-list] Variant parameterized method?
Date: Tue, 22 Jul 2003 17:34:44 -0500 (CDT) [thread overview]
Message-ID: <Pine.LNX.4.33.0307221728020.2041-100000@eagle.ancor.com> (raw)
In-Reply-To: <20030723070614J.garrigue@kurims.kyoto-u.ac.jp>
Thanks for your help.
On Wed, 23 Jul 2003, Jacques Garrigue wrote:
> This precise type is not admissible in the ocaml type system.
> In ocaml recursive types must be regular: only 'a foo may occur in the
> expansion of 'a foo.
Ah. Any hope of getting this fixed?
>
> This problem is discussed in an answer to PR#1730 in the caml bug
> database.
Unfortunately, I don't speak french.
> This can be solved by introducing an explicit wrapper.
This is one possibility.
> If you think (as I do) that all these examples are just too
> complicated in practice, there is a simpler way to go:
> only define a fold method in your class, and define map itself out of
> 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
prev parent reply other threads:[~2003-07-22 22:35 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2003-07-22 20:09 Brian Hurt
2003-07-22 22:06 ` Jacques Garrigue
2003-07-22 22:34 ` Brian Hurt [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=Pine.LNX.4.33.0307221728020.2041-100000@eagle.ancor.com \
--to=brian.hurt@qlogic.com \
--cc=caml-list@inria.fr \
--cc=garrigue@kurims.kyoto-u.ac.jp \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox