From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Original-To: caml-list@yquem.inria.fr Delivered-To: caml-list@yquem.inria.fr Received: from mail2-relais-roc.national.inria.fr (mail2-relais-roc.national.inria.fr [192.134.164.83]) by yquem.inria.fr (Postfix) with ESMTP id A25E9BC57 for ; Wed, 21 Jul 2010 16:13:28 +0200 (CEST) X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AisCAEudRkzRVaE2kGdsb2JhbACTM4w0CBUBAQEBCQkMBxEDH69qghCFdC6IVAEBAwWFLQSIWQ X-IronPort-AV: E=Sophos;i="4.55,238,1278280800"; d="scan'208";a="55937376" Received: from mail-fx0-f54.google.com ([209.85.161.54]) by mail2-smtp-roc.national.inria.fr with ESMTP; 21 Jul 2010 16:13:28 +0200 Received: by fxm13 with SMTP id 13so4311437fxm.27 for ; Wed, 21 Jul 2010 07:13:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:received:in-reply-to :references:date:message-id:subject:from:to:cc:content-type :content-transfer-encoding; bh=gvDT9UKtSeLuE82Cig0HV1EYNAfhh/K4QRP5UwyRIVk=; b=g2wn93FPNVA1fSja1Vxh6W0QcB5BfNTZuUC3Ao3tKjQTYRsCSekTkkvlGuMdcqVAte iPIltrOKeQF+c3QsX948NIp+Usx6YUBm7W9rmNlEbuJTnc0/slMKYAW9fjToHOuR2r0e Keo2gK25ybxfY1xeOgHTMJ5jXYFqO0Blqhkbs= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type:content-transfer-encoding; b=X7M2lmIul4YK7fwrewVEIgchhuqD2/I+mieiZpzfRawycmy4H8OHtc47s/retbRhwp McVHpJ7jhCh5qWle3lY/IOgCbjglznJz1+r9tZ7QIMMbU+T9qitzOuB6BVJeksKaJf6M 3ie7HGUWB0GMtYd9wDKK1e7lMEencwwfICzu4= MIME-Version: 1.0 Received: by 10.239.132.206 with SMTP id 14mr21417hbs.152.1279721608128; Wed, 21 Jul 2010 07:13:28 -0700 (PDT) Received: by 10.239.161.82 with HTTP; Wed, 21 Jul 2010 07:13:28 -0700 (PDT) In-Reply-To: <4C46F866.9050900@inria.fr> References: <4C46F866.9050900@inria.fr> Date: Wed, 21 Jul 2010 15:13:28 +0100 Message-ID: Subject: Re: [Caml-list] Bug in the module system of version 3.12.0+beta1 From: Jeremy Yallop To: dumitru.potop@inria.fr Cc: caml-list@inria.fr Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable X-Spam: no; 0.00; bug:01 functor:01 sig:01 val:01 functor:01 sig:01 val:01 ocaml:01 wrote:01 signatures:01 signatures:01 opaque:01 caml-list:01 int:01 int:01 On 21 July 2010 14:38, Dumitru Potop-Butucaru wrote: > module type Abc =3D > =A0 functor (M:Simple) -> > =A0 sig > =A0 =A0 =A0val x : M.t > =A0 end You're trying to treat Abc as a functor from signatures to signatures (i.e. as a parameterised signature). In fact, it's something quite different: it's the *type* of a functor from structures to structures. You can emulate a parameterised signature using a signature with some opaque components, which are later specified using substitution. Here's the "parametrised signature": module type ABC =3D sig module M : Simple val x : M.t end Here's how to supply a value for M: module MyModule : sig include ABC with module M =3D IntList val y : int end =3D ... In OCaml 3.12 you can use destructive substitution instead, ensuring that M doesn't appear in the output signature. Note the ':=3D' in the line that includes ABC: module MyModule : sig include ABC with module M :=3D IntList val y : int end =3D ...