caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: Philippe Wang <mail@philippewang.info>
To: Markus Mottl <markus.mottl@gmail.com>
Cc: OCaml List <caml-list@yquem.inria.fr>
Subject: Re: [Caml-list] First-class modules in functor bodies
Date: Mon, 20 May 2013 00:07:07 +0100	[thread overview]
Message-ID: <CAAFfW_pNL_cB6FTDCd50CC5e_pYsO0RLQJkRrHTmdA=aPFFSwQ@mail.gmail.com> (raw)
In-Reply-To: <CAP_800qQSBK1YDkT5i6FoSEEfzhBbqWSWUDqpFis2hwGiYBM8Q@mail.gmail.com>

I'm curious because I don't quite understand: could you tell the
supposed semantic differences between your code and the following
code?
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 = struct let a = a end
end

On Sun, May 19, 2013 at 4:14 PM, Markus Mottl <markus.mottl@gmail.com> wrote:
> 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
>
> --
> Caml-list mailing list.  Subscription management and archives:
> https://sympa.inria.fr/sympa/arc/caml-list
> Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
> Bug reports: http://caml.inria.fr/bin/caml-bugs



-- 
Philippe Wang
   mail@philippewang.info

  reply	other threads:[~2013-05-19 23:07 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-05-19 15:14 Markus Mottl
2013-05-19 23:07 ` Philippe Wang [this message]
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='CAAFfW_pNL_cB6FTDCd50CC5e_pYsO0RLQJkRrHTmdA=aPFFSwQ@mail.gmail.com' \
    --to=mail@philippewang.info \
    --cc=caml-list@yquem.inria.fr \
    --cc=markus.mottl@gmail.com \
    /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;
as well as URLs for NNTP newsgroup(s).