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 C95E17FCCB for ; Sun, 10 May 2015 23:58:11 +0200 (CEST) Received-SPF: None (mail2-smtp-roc.national.inria.fr: no sender authenticity information available from domain of jordojw@gmail.com) identity=pra; client-ip=209.85.217.181; receiver=mail2-smtp-roc.national.inria.fr; envelope-from="jordojw@gmail.com"; x-sender="jordojw@gmail.com"; x-conformance=sidf_compatible Received-SPF: Pass (mail2-smtp-roc.national.inria.fr: domain of jordojw@gmail.com designates 209.85.217.181 as permitted sender) identity=mailfrom; client-ip=209.85.217.181; receiver=mail2-smtp-roc.national.inria.fr; envelope-from="jordojw@gmail.com"; x-sender="jordojw@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-lb0-f181.google.com) identity=helo; client-ip=209.85.217.181; receiver=mail2-smtp-roc.national.inria.fr; envelope-from="jordojw@gmail.com"; x-sender="postmaster@mail-lb0-f181.google.com"; x-conformance=sidf_compatible X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: A0DgAQDI009VlLXZVdFchEEGgxjKRAc8EAEBAQEBAQERAQEBAQcLCwkfMIQ5ER0BGx4DEgMGBzcCJAERAQUBIhsah3QBAxKWSI0wgzA+MYs4gWuCd4gpChknDVeEYQEFDosrh3SBRQWMG5EFlQ0SI4EMCYIJgjEeMYJGAQEB X-IPAS-Result: A0DgAQDI009VlLXZVdFchEEGgxjKRAc8EAEBAQEBAQERAQEBAQcLCwkfMIQ5ER0BGx4DEgMGBzcCJAERAQUBIhsah3QBAxKWSI0wgzA+MYs4gWuCd4gpChknDVeEYQEFDosrh3SBRQWMG5EFlQ0SI4EMCYIJgjEeMYJGAQEB X-IronPort-AV: E=Sophos;i="5.13,403,1427752800"; d="scan'208";a="141778839" Received: from mail-lb0-f181.google.com ([209.85.217.181]) by mail2-smtp-roc.national.inria.fr with ESMTP/TLS/RC4-SHA; 10 May 2015 23:58:11 +0200 Received: by lbcga7 with SMTP id ga7so82531028lbc.1 for ; Sun, 10 May 2015 14:58:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:date:message-id:subject:from:to:content-type; bh=IvNqhg5oYqR+ZNTnfgkU178mYkIzW+koEnx3+9vO60U=; b=RLGK8x2NuGgVds+vPI11u8foMbyx7W6L7VzdXZNKTLXUYdZh6raXOF29KgDzlWxAI6 bDAiHnODUjXeyX9DfUIh/6+BOf6uGaZILekVZAQ0XsY5T+Pp/S1FwGm5NIJARridynZQ ZjMXqwgGAFsbsbJZJldhhMYAZ4VzCf9rKMnW6XDdl4ItfgjyQHGWc2KM8Uq2CeBMs4Mx 3PvcWmFmcuSeWtJl3L5M6l9so+D9UfTZ54cGzTzq2wZVkVcB+mr7xv6EN3NCgDEhmB2F mBVJNYyAzvHM/YCM3PyEI68yfVyd9dVI5Tpa2l+v/YXnHkKvzKa1fDImyO4v6Al1LTME BF8Q== MIME-Version: 1.0 X-Received: by 10.112.156.97 with SMTP id wd1mr5730080lbb.30.1431295090604; Sun, 10 May 2015 14:58:10 -0700 (PDT) Received: by 10.25.22.224 with HTTP; Sun, 10 May 2015 14:58:10 -0700 (PDT) Date: Sun, 10 May 2015 14:58:10 -0700 Message-ID: From: Jordan W To: "caml-list@inria.fr" Content-Type: multipart/alternative; boundary=089e0112cc8071c0f60515c15bc1 X-Validation-by: jordojw@gmail.com Subject: [Caml-list] Record fields not reexported from functors. --089e0112cc8071c0f60515c15bc1 Content-Type: text/plain; charset=UTF-8 I believe there is an issue with record fields and functors. It appears that while types are correctly exported from functors, the corresponding record field scopes are not. Here is an example. module type HasType = sig type t end module EchoModule (Input:HasType): (HasType with type t = Input.t) = (struct type t = Input.t end) module ClonedModuleWithRecordType = EchoModule (struct type t = {innerRecordField: int} end) (* This doesn't type check, but I can't see why it shouldn't. Record fields' scopes should be reexported just like the types themselves. let myRecord: ClonedModuleWithRecordType.t = { ClonedModuleWithRecordType.innerRecordField=10; } In this case, the original "scope" of the record fields is "lost" because the record type was declared in an anonymous module expression. I believe that it *should* be "lost" as it is, but then reexported as an identical type in the module returned from the functor (identically because of the "with constraint"). *) module ClonedModuleWithNonRecordType = EchoModule (struct type t = string list end) (* This typechecks perfectly fine! Evidence that types are reexported, but not the "scope" of record labels *) let myRecord: ClonedModuleWithNonRecordType.t = ["asdf"; "fff"] Is anyone aware of whether or not this issue is already being tracked? --089e0112cc8071c0f60515c15bc1 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable
I believe there is an issue with record fields a= nd functors.
It appears that while types are correctly exported from fun= ctors, the corresponding record field scopes are not. Here is an example.
=C2=A0 =C2=A0module type HasType =3D sig
=C2=A0 =C2=A0 =C2= =A0 type t
=C2=A0 =C2=A0 end

=C2=A0 =C2= =A0 module EchoModule (Input:HasType): (HasType with type t =3D Input.t) = =3D (struct
=C2=A0 =C2=A0 =C2=A0 type t =3D Input.t
=C2= =A0 =C2=A0 end)

=C2=A0 =C2=A0 module ClonedModuleW= ithRecordType =3D EchoModule (struct
=C2=A0 =C2=A0 =C2=A0 type t = =3D {innerRecordField: int}
=C2=A0 =C2=A0 end)

=C2=A0 =C2=A0 (* This doesn't type check, but I can't see wh= y it shouldn't. Record fields'
=C2=A0 =C2=A0 =C2=A0 =C2= =A0scopes should be reexported just like the types themselves.
=C2=A0 =C2=A0 =C2=A0 let myRecord: ClonedModuleWithRecordType.= t =3D {
=C2=A0 =C2=A0 =C2=A0 =C2=A0 ClonedModuleWithRecordType.in= nerRecordField=3D10;
=C2=A0 =C2=A0 =C2=A0 }
=C2=A0 =C2= =A0 =C2=A0=C2=A0
=C2=A0 =C2=A0 =C2=A0 In this case, the original = "scope" of the record fields is "lost"
=C2=A0= =C2=A0 =C2=A0 because the record type was declared in an anonymous module = expression. =C2=A0I
=C2=A0 =C2=A0 =C2=A0 believe that it *should*= be "lost" as it is, but then reexported as an
=C2=A0 = =C2=A0 =C2=A0 identical type in the module returned from the functor (ident= ically because
=C2=A0 =C2=A0 =C2=A0 of the "with constraint&= quot;).
=C2=A0 =C2=A0 =C2=A0=C2=A0
=C2=A0 =C2=A0 *)

=C2=A0 =C2=A0 module ClonedModuleWithNonRecordType = =3D EchoModule (struct
=C2=A0 =C2=A0 =C2=A0 type t =3D string lis= t
=C2=A0 =C2=A0 end)

=C2=A0 =C2=A0 (* Th= is typechecks perfectly fine! Evidence that types are reexported, but not
=C2=A0 =C2=A0 =C2=A0 =C2=A0the "scope" of record labels = *)
=C2=A0 =C2=A0 let myRecord: ClonedModuleWithNonRecordType.t = =3D ["asdf"; "fff"]


Is anyone aware of wheth= er or not this issue is already being tracked?

--089e0112cc8071c0f60515c15bc1--