caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
* [Caml-list] First-class modules in functor bodies
@ 2013-05-19 15:14 Markus Mottl
  2013-05-19 23:07 ` Philippe Wang
  2013-05-20  7:31 ` Alain Frisch
  0 siblings, 2 replies; 6+ messages in thread
From: Markus Mottl @ 2013-05-19 15:14 UTC (permalink / raw)
  To: OCaml List

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

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2013-05-20 14:13 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-05-19 15:14 [Caml-list] First-class modules in functor bodies Markus Mottl
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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).