From: Markus Mottl <markus.mottl@gmail.com>
To: OCaml List <caml-list@yquem.inria.fr>
Subject: [Caml-list] First-class modules in functor bodies
Date: Sun, 19 May 2013 11:14:46 -0400 [thread overview]
Message-ID: <CAP_800qQSBK1YDkT5i6FoSEEfzhBbqWSWUDqpFis2hwGiYBM8Q@mail.gmail.com> (raw)
Hi,
I've been wondering why the following is disallowed:
-----
module M (U : sig end) = struct
module type S = sig val x : int end
let a = ((module struct let x = 42 end : S))
module A = (val a)
end
-----
The error message is:
-----
File "foo.ml", line 4, characters 13-20:
Error: This kind of expression is not allowed within the body of a functor.
-----
Making M a module by removing the functor argument works as expected.
Is there some inherent unsoundness issue with allowing this kind of
use of first-class modules within functor bodies, or would it just be
hard adding sound support for the above to the current type system?
Regards,
Markus
--
Markus Mottl http://www.ocaml.info markus.mottl@gmail.com
next reply other threads:[~2013-05-19 15:14 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-05-19 15:14 Markus Mottl [this message]
2013-05-19 23:07 ` Philippe Wang
2013-05-20 0:26 ` Markus Mottl
2013-05-20 7:31 ` Alain Frisch
2013-05-20 14:01 ` Markus Mottl
2013-05-20 14:07 ` Jacques Carette
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=CAP_800qQSBK1YDkT5i6FoSEEfzhBbqWSWUDqpFis2hwGiYBM8Q@mail.gmail.com \
--to=markus.mottl@gmail.com \
--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