From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail4-relais-sop.national.inria.fr (mail4-relais-sop.national.inria.fr [192.134.164.105]) by walapai.inria.fr (8.13.6/8.13.6) with ESMTP id q1MHPhVW009853 for ; Wed, 22 Feb 2012 18:25:43 +0100 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AmsCAE4kRU/RVdS2imdsb2JhbAA7CYUsm2eRLQgiAQEBCgkNGQYjgXMBAQEEEgIPHQEbEgsBAwwGBQsNAgIJHQICIQEBEQEFAQoSBhMSCQeHaKEYCosmTIJxhS0/gQsCBQuBJIdQWAiDAwEJFw8EBQoDAwcDAgUKBg8IAoUWSgYFCwoIAwSCF4EWBJU4hxeEAIMWPYQEgVIJ X-IronPort-AV: E=Sophos;i="4.73,465,1325458800"; d="scan'208";a="132475749" Received: from mail-wi0-f182.google.com ([209.85.212.182]) by mail4-smtp-sop.national.inria.fr with ESMTP/TLS/RC4-SHA; 22 Feb 2012 18:25:37 +0100 Received: by wibhn14 with SMTP id hn14so306718wib.27 for ; Wed, 22 Feb 2012 09:25:37 -0800 (PST) Received-SPF: pass (google.com: domain of gabriel.scherer@gmail.com designates 10.180.85.105 as permitted sender) client-ip=10.180.85.105; Authentication-Results: mr.google.com; spf=pass (google.com: domain of gabriel.scherer@gmail.com designates 10.180.85.105 as permitted sender) smtp.mail=gabriel.scherer@gmail.com; dkim=pass header.i=gabriel.scherer@gmail.com Received: from mr.google.com ([10.180.85.105]) by 10.180.85.105 with SMTP id g9mr38640407wiz.12.1329931537788 (num_hops = 1); Wed, 22 Feb 2012 09:25:37 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc:content-type:content-transfer-encoding; bh=soz97KMHTff+8ykRTDcOO0oTH65YVWHyZNXQhy5Q4as=; b=CGykA4j0taVmhpNilZ4OgS886BuHpSeQ6w4ygEHWihhg2uEsCV8WHXfVaHU9yhReHX iF0EdEgWkpFNBPOZxrozXi7TMX7VhPLSb9NLgsSFfZowWOtyBqxtE2NAyGT+JMfn4HRO NLE3SblIb7irdOG3KsTLeUznFa6pK0+CsNJYA= Received: by 10.180.85.105 with SMTP id g9mr32092373wiz.12.1329931537655; Wed, 22 Feb 2012 09:25:37 -0800 (PST) MIME-Version: 1.0 Received: by 10.227.63.13 with HTTP; Wed, 22 Feb 2012 09:24:57 -0800 (PST) In-Reply-To: References: From: Gabriel Scherer Date: Wed, 22 Feb 2012 18:24:57 +0100 Message-ID: To: Till Varoquaux Cc: =?ISO-8859-2?Q?Milan_Stanojevi=E6?= , "Hezekiah M. Carty" , Ashish Agarwal , Caml List Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-MIME-Autoconverted: from quoted-printable to 8bit by walapai.inria.fr id q1MHPhVW009853 Subject: Re: [Caml-list] Re: "module type of" on sub-module of functor result > [A(B)] and [A.B] are syntacticly valid module_expr's but > [A(B).C] isn't. Is this because of an inherent limitation in the > module system? I believe so. When you apply a functor, you may get fresh types as a result -- the generative (abstract, algebraic) types of the functor image. If you write `module M = A(B)`, the fresh types have a clear identity: M.t, M.q etc; similarly if you pass A(B) to a functor with formal parameter X, it is X.t, X.q etc. But if you write `module M = A(B).C`, there is no syntactic way to name the fresh types generated by the functor application; in particular, naming them A(B).t would be incorrect -- because you could mix types of different applications. For example, what would be the signature of A(B).C with: module B = struct end module A(X : sig end) = struct type t module C = struct type q = t end end ? 2012/2/22 Till Varoquaux : > 2012/2/22 Milan Stanojević d >> On Tue, Feb 21, 2012 at 3:32 PM, Hezekiah M. Carty wrote: >>> On Tue, Feb 21, 2012 at 2:37 PM, Ashish Agarwal wrote: >>>> I must've accidentally deleted part of my email before hitting send. The >>>> point was to make the first code sample compile after removing the commented >>>> line. But that is not allowed; I get a syntax error: >>>> >>>> $ ocamlfind ocamlc -c -package batteries a.ml >>>> File "a.ml", line 6, characters 38-39: >>>> Error: Syntax error: 'end' expected >>>> File "a.ml", line 4, characters 16-19: >>>> Error: This 'sig' might be unmatched >>>> >>>> I'm wondering if there is a better solution than my second code sample. >>>> >> >> I would consider this a bug. I think than any module expression than >> can be used with "include" should be usable with "include module type >> of" >> >> -- >> Caml-list mailing list.  Subscription management and archives: >> https://sympa-roc.inria.fr/wws/info/caml-list >> Beginner's list: http://groups.yahoo.com/group/ocaml_beginners >> Bug reports: http://caml.inria.fr/bin/caml-bugs >> > > Milan is right: the language grammar does say that both [include] and > [module type of] should work on module_expr. However, based upon the > manual(*),  [A(B)] and  [A.B] are syntacticly valid module_expr's but > [A(B).C] isn't. Is this because of an inherent limitation in the > module system? > > [*]http://caml.inria.fr/pub/docs/manual-ocaml/manual019.html#module-expr > > > -- > Caml-list mailing list.  Subscription management and archives: > https://sympa-roc.inria.fr/wws/info/caml-list > Beginner's list: http://groups.yahoo.com/group/ocaml_beginners > Bug reports: http://caml.inria.fr/bin/caml-bugs >