caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
* [Caml-list] A limitation of "with type" declarations for first-class modules
@ 2011-09-20  1:36 Yaron Minsky
  2011-09-20  8:00 ` Jacques Le Normand
  2011-09-20  9:03 ` Alain Frisch
  0 siblings, 2 replies; 7+ messages in thread
From: Yaron Minsky @ 2011-09-20  1:36 UTC (permalink / raw)
  To: caml-list

[-- Attachment #1: Type: text/plain, Size: 787 bytes --]

For some reason, 1st-class modules have more restrictive "with" syntax,
which turns out to be a practical problem.

The main constraint is that with constraints do not seem to be able to refer
to sub-modules.  Consider the following code snippet:

>     module type Foo = sig type t end
>     module type Bar = sig module Foo : Foo end
>
>     (* compiles *)
>     let g (type a) (m : (module Foo with type t = a)) = ()
>
>     (* fails to compile with a syntax error *)
>     let f (type a) (m : (module Bar with type Foo.t = a)) = ()

Of course, ordinary modules have no such constraint.  Any thoughts as to
what is going on here, and whether it can be fixed?  This has really
restricted designs I've been using, forcing me to flatten out structures
that are more naturally nested.

y

[-- Attachment #2: Type: text/html, Size: 1695 bytes --]

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

end of thread, other threads:[~2011-09-20 10:13 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-09-20  1:36 [Caml-list] A limitation of "with type" declarations for first-class modules Yaron Minsky
2011-09-20  8:00 ` Jacques Le Normand
2011-09-20  8:10   ` Yaron Minsky
2011-09-20  9:03 ` Alain Frisch
2011-09-20  9:23   ` Jacques Le Normand
2011-09-20 10:07   ` Yaron Minsky
2011-09-20 10:13     ` Yaron Minsky

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).