From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Original-To: caml-list@sympa.inria.fr Delivered-To: caml-list@sympa.inria.fr Received: from mail2-relais-roc.national.inria.fr (mail2-relais-roc.national.inria.fr [192.134.164.83]) by sympa.inria.fr (Postfix) with ESMTPS id 965317EE51 for ; Mon, 20 May 2013 01:07:08 +0200 (CEST) Received-SPF: None (mail2-smtp-roc.national.inria.fr: no sender authenticity information available from domain of philippe.wang.lists@gmail.com) identity=pra; client-ip=74.125.82.181; receiver=mail2-smtp-roc.national.inria.fr; envelope-from="philippe.wang.lists@gmail.com"; x-sender="philippe.wang.lists@gmail.com"; x-conformance=sidf_compatible Received-SPF: Pass (mail2-smtp-roc.national.inria.fr: domain of philippe.wang.lists@gmail.com designates 74.125.82.181 as permitted sender) identity=mailfrom; client-ip=74.125.82.181; receiver=mail2-smtp-roc.national.inria.fr; envelope-from="philippe.wang.lists@gmail.com"; x-sender="philippe.wang.lists@gmail.com"; x-conformance=sidf_compatible; x-record-type="v=spf1" Received-SPF: None (mail2-smtp-roc.national.inria.fr: no sender authenticity information available from domain of postmaster@mail-we0-f181.google.com) identity=helo; client-ip=74.125.82.181; receiver=mail2-smtp-roc.national.inria.fr; envelope-from="philippe.wang.lists@gmail.com"; x-sender="postmaster@mail-we0-f181.google.com"; x-conformance=sidf_compatible X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AmYCAIBamVFKfVK1k2dsb2JhbABagzivIZMPCBYOAQEBAQcLCwkUBCSCHwEBBUABFBkLAQMMAQUFCw0NISEBEgEFAQoSBhMSh2kDDwyeWY88g3gnAwqIaAEFDIw+gSWFDQOOPYcVgWaBKYp0gz4WKYFdglk7gTU X-IPAS-Result: AmYCAIBamVFKfVK1k2dsb2JhbABagzivIZMPCBYOAQEBAQcLCwkUBCSCHwEBBUABFBkLAQMMAQUFCw0NISEBEgEFAQoSBhMSh2kDDwyeWY88g3gnAwqIaAEFDIw+gSWFDQOOPYcVgWaBKYp0gz4WKYFdglk7gTU X-IronPort-AV: E=Sophos;i="4.87,704,1363129200"; d="scan'208";a="18126069" Received: from mail-we0-f181.google.com ([74.125.82.181]) by mail2-smtp-roc.national.inria.fr with ESMTP/TLS/RC4-SHA; 20 May 2013 01:07:08 +0200 Received: by mail-we0-f181.google.com with SMTP id u57so291355wes.26 for ; Sun, 19 May 2013 16:07:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:sender:in-reply-to:references:date :x-google-sender-auth:message-id:subject:from:to:cc:content-type; bh=P1a0Bgs/Lbx/KgD7oXQOyPab+BdxOZEF1JJtoUEiCss=; b=JkFbpQjiJFAHGMgdCFtyPAUn2zAGAnScDy4gfMQVDcIgm+J/7BaG5NzsWVNHSP66mI y7gEhPUmgA/69ypnaU67gnY+/InImF+j2TxtOk4RQpJO5CMlk36PCEKoRoQcOYmlFtuy KT1XFgjOHprX3d/wB2tLZGeZmxstYvlTRqAswmHczFthpY6yNZGUfGkxkhvKzWgwQBXB cHmJkzhz7SuhNgBY12IF8Cm5mBKUnL1pGYuppyKuGrhKrkA0nc+Q9XsjhgXl5MVPu1i/ KBqiGrm3/5LxzM1KYRWRWwqJ/YmLjvGXk6gvF9XH1/tckH0veO+VQC6myjjhsTiju7Sa 9y8Q== MIME-Version: 1.0 X-Received: by 10.180.182.229 with SMTP id eh5mr8430918wic.6.1369004827665; Sun, 19 May 2013 16:07:07 -0700 (PDT) Sender: philippe.wang.lists@gmail.com Received: by 10.217.61.5 with HTTP; Sun, 19 May 2013 16:07:07 -0700 (PDT) In-Reply-To: References: Date: Mon, 20 May 2013 00:07:07 +0100 X-Google-Sender-Auth: 6q5Yjr0KVCWSM_FaFDvpFSyd_jI Message-ID: From: Philippe Wang To: Markus Mottl Cc: OCaml List Content-Type: text/plain; charset=ISO-8859-1 Subject: Re: [Caml-list] First-class modules in functor bodies 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 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