From: "Yann Régis-Gianas" <yann.regis-gianas@inria.fr>
To: caml-list@yquem.inria.fr
Subject: Re: [Caml-list] mutually dependent class and type
Date: Sun, 5 Oct 2008 15:31:35 +0200 [thread overview]
Message-ID: <1af89fca0810050631r6f9303e5s9d1b973423fa6122@mail.gmail.com> (raw)
In-Reply-To: <20080925222439.GA7968@galois>
Hello Sebastien,
you can use recursive module:
module rec I : sig
class element : I.content -> object end
type content =
| Data of string
| Elements of I.element list
end = struct
class element (c : I.content) = object end
type content =
| Data of string
| Elements of I.element list
end
Best regards,
--
Yann Régis-Gianas
On Fri, Sep 26, 2008 at 12:24 AM, Sébastien Hinderer
<Sebastien.Hinderer@ens-lyon.org> wrote:
> Dear list,
>
> Is there a (clean) way to define simultaneously a class and a type that
> are mutually recursive ?
> Something like this :
> class element (c : content) =
> object
> ...
> end and type content =
> | Data of string
> | Elements of element list;;
>
> This is of course not a valid OCaml definition, but is there a way to
> express it ?
>
> Many thanks in advance for your help,
> Sébastien.
>
> _______________________________________________
> Caml-list mailing list. Subscription management:
> http://yquem.inria.fr/cgi-bin/mailman/listinfo/caml-list
> Archives: http://caml.inria.fr
> Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
> Bug reports: http://caml.inria.fr/bin/caml-bugs
>
prev parent reply other threads:[~2008-10-05 13:31 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-09-25 22:24 Sébastien Hinderer
2008-09-25 23:41 ` [Caml-list] " Martin Jambon
2008-09-26 6:40 ` Tim Rentsch
2008-10-05 13:31 ` Yann Régis-Gianas [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=1af89fca0810050631r6f9303e5s9d1b973423fa6122@mail.gmail.com \
--to=yann.regis-gianas@inria.fr \
--cc=caml-list@yquem.inria.fr \
/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