Mailing list for all users of the OCaml language and system.
 help / color / mirror / Atom feed
From: "Jérémie Lumbroso" <jeremie.lumbroso@etu.upmc.fr>
To: caml-list@inria.fr
Subject: Specifying recursive modules?
Date: Wed, 20 Aug 2008 16:31:51 +0200	[thread overview]
Message-ID: <2b7b425b0808200731x6dd6aa12udd03c16dbb8eae05@mail.gmail.com> (raw)

Hello,

I'd always thought of separating specification and definition as
simply not possible in OCaml, but OCaml's reference manual (3.10,
which is, as far as I can tell, the most recent version of the
documentation) seems to contradict my assumption:

http://caml.inria.fr/pub/docs/manual-ocaml/manual021.html#htoc100

It says that recursive specifications can be written as:

  <code>
  module rec <mod-name> : <mod-type> { and ... }
  </code>

What does this mean? When I attempt to use this feature in the
toplevel, it results in an error:

  <toplevel>
  # module rec Tmp : sig
      type t = Stop | Next of Tmp.t
    end**;;**
  Syntax error
  </toplevel>

On the off-chance that OCaml might explicitly need an "and", I also
tried adding a second dummy module to the definition, but no dice ...
When I try to use this feature in a .mli/.ml file coupling, I get the
same (syntax) error. Have I misunderstood the usage? Or has this been
removed since its introduction (and the documentation not updated
accordingly)? Or is this a bug?

Jérémie


             reply	other threads:[~2008-08-20 14:33 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-08-20 14:31 Jérémie Lumbroso [this message]
2008-08-20 14:53 ` [Caml-list] " Martin Jambon

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=2b7b425b0808200731x6dd6aa12udd03c16dbb8eae05@mail.gmail.com \
    --to=jeremie.lumbroso@etu.upmc.fr \
    --cc=caml-list@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