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 75F237EE51 for ; Sun, 19 May 2013 17:14:47 +0200 (CEST) Received-SPF: None (mail2-smtp-roc.national.inria.fr: no sender authenticity information available from domain of markus.mottl@gmail.com) identity=pra; client-ip=74.125.82.176; receiver=mail2-smtp-roc.national.inria.fr; envelope-from="markus.mottl@gmail.com"; x-sender="markus.mottl@gmail.com"; x-conformance=sidf_compatible Received-SPF: Pass (mail2-smtp-roc.national.inria.fr: domain of markus.mottl@gmail.com designates 74.125.82.176 as permitted sender) identity=mailfrom; client-ip=74.125.82.176; receiver=mail2-smtp-roc.national.inria.fr; envelope-from="markus.mottl@gmail.com"; x-sender="markus.mottl@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-f176.google.com) identity=helo; client-ip=74.125.82.176; receiver=mail2-smtp-roc.national.inria.fr; envelope-from="markus.mottl@gmail.com"; x-sender="postmaster@mail-we0-f176.google.com"; x-conformance=sidf_compatible X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AlECAA/smFFKfVKwk2dsb2JhbABbgzjCMAgWDgEBAQEHCwsJFAQkgmYBFAceAxIQXAEBEQEFASITCIdyAQMPnCKCdow/gn2DUQoZJw1YiBABBQyMPoYyA5VSgWaMHYM+FimEUSA X-IPAS-Result: AlECAA/smFFKfVKwk2dsb2JhbABbgzjCMAgWDgEBAQEHCwsJFAQkgmYBFAceAxIQXAEBEQEFASITCIdyAQMPnCKCdow/gn2DUQoZJw1YiBABBQyMPoYyA5VSgWaMHYM+FimEUSA X-IronPort-AV: E=Sophos;i="4.87,704,1363129200"; d="scan'208";a="18108423" Received: from mail-we0-f176.google.com ([74.125.82.176]) by mail2-smtp-roc.national.inria.fr with ESMTP/TLS/RC4-SHA; 19 May 2013 17:14:47 +0200 Received: by mail-we0-f176.google.com with SMTP id p58so1357802wes.21 for ; Sun, 19 May 2013 08:14:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:x-received:date:message-id:subject:from:to :content-type; bh=FH+YTRmjiwkW3jTsaFZBlv8Js1b4vkz5Rb1gM/3xQNo=; b=KwvbR4/ns0OJUEPxNTT/rZqNdhd2H5anvd+/NcL1J3xh3XqLm3GXUTr+DFM+b1R0xy AogVzk9gjw300SI5gt6DYCZ25GKFpATsWqgAopHSiGBZ9zaiT3QqMoh/d7djqZz8QEui U+VHUqcfp9c2gnJSYYEweDG3qpqDCtJkQqF3R0/e7QSI2hPMWkqeGejvNMOs5dQRJ0md p9dSPpZTEIyb2nXdDSTs2dIGbIcoOuqvQTya5jgpE9VvjIzvNLGB2AA8VQSDYjZGWijv LJNlSgZhpzVwOeVxcpC39e4nwG40vLe08M0BQFrbKhvGXHArz0QTgF07SdpCQZsZDm78 rlqQ== MIME-Version: 1.0 X-Received: by 10.180.185.44 with SMTP id ez12mr6200979wic.7.1368976486914; Sun, 19 May 2013 08:14:46 -0700 (PDT) Received: by 10.194.16.70 with HTTP; Sun, 19 May 2013 08:14:46 -0700 (PDT) Date: Sun, 19 May 2013 11:14:46 -0400 Message-ID: From: Markus Mottl To: OCaml List Content-Type: text/plain; charset=ISO-8859-1 Subject: [Caml-list] First-class modules in functor bodies 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