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 58E787F8F3 for ; Mon, 26 May 2014 11:15:06 +0200 (CEST) Received-SPF: None (mail2-smtp-roc.national.inria.fr: no sender authenticity information available from domain of goswin-v-b@web.de) identity=pra; client-ip=212.227.15.3; receiver=mail2-smtp-roc.national.inria.fr; envelope-from="goswin-v-b@web.de"; x-sender="goswin-v-b@web.de"; x-conformance=sidf_compatible Received-SPF: None (mail2-smtp-roc.national.inria.fr: no sender authenticity information available from domain of goswin-v-b@web.de) identity=mailfrom; client-ip=212.227.15.3; receiver=mail2-smtp-roc.national.inria.fr; envelope-from="goswin-v-b@web.de"; x-sender="goswin-v-b@web.de"; x-conformance=sidf_compatible Received-SPF: None (mail2-smtp-roc.national.inria.fr: no sender authenticity information available from domain of postmaster@mout.web.de) identity=helo; client-ip=212.227.15.3; receiver=mail2-smtp-roc.national.inria.fr; envelope-from="goswin-v-b@web.de"; x-sender="postmaster@mout.web.de"; x-conformance=sidf_compatible X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AlgBAOMFg1PU4w8DnGdsb2JhbABZsXOUTgGBDxYOAQEBAQEGDQkJFCiCJQEBBTpPCxgJJQ8FKIhhARjQOR+GUheOWRaDFYEVAQOZcoZVEo97 X-IPAS-Result: AlgBAOMFg1PU4w8DnGdsb2JhbABZsXOUTgGBDxYOAQEBAQEGDQkJFCiCJQEBBTpPCxgJJQ8FKIhhARjQOR+GUheOWRaDFYEVAQOZcoZVEo97 X-IronPort-AV: E=Sophos;i="4.98,911,1392159600"; d="scan'208";a="76331867" Received: from mout.web.de ([212.227.15.3]) by mail2-smtp-roc.national.inria.fr with ESMTP/TLS/DHE-RSA-AES256-SHA; 26 May 2014 11:14:48 +0200 Received: from frosties.localnet ([78.43.112.61]) by smtp.web.de (mrweb003) with ESMTPSA (Nemesis) id 0LmLac-1WFF3c2j7i-00ZtAx for ; Mon, 26 May 2014 11:14:46 +0200 Received: from mrvn by frosties.localnet with local (Exim 4.82) (envelope-from ) id 1WoqzV-0006hr-8E for caml-list@inria.fr; Mon, 26 May 2014 11:14:45 +0200 Date: Mon, 26 May 2014 11:14:45 +0200 From: Goswin von Brederlow To: caml-list@inria.fr Message-ID: <20140526091445.GB24582@frosties> References: <52C51721-8564-472C-AA7A-2ABE66C4D809@my.bristol.ac.uk> <20140525105906.GB7716@kerneis.info> <15117B8E-A404-4911-AC68-769CDF00B22E@my.bristol.ac.uk> <5B604612-B40C-459F-9D5F-76B61ABE1B58@my.bristol.ac.uk> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.23 (2014-03-12) X-Provags-ID: V03:K0:Ke0hmy8D8BQn39QqF8sRBv2RB0scBFvmBs5b9hHqoRrCF5/pUJV eOYKnXWKVyOOUEXnpAl8bKveerMXpKl2eENSkzsHyVlV7P2OtcWt8j7bD28hDK9jZKKDY+8 wrYOLjBd/pkCezSev9GI3CD9e+ufFNJzcajNUHUW45z3DGADyBS9PW986nDeEnwzdYMHIhY B2fAlVJkun/tVKhBcrStg== Subject: Re: [Caml-list] Modules and record fields On Sun, May 25, 2014 at 05:02:46PM +0200, Gabriel Scherer wrote: > When I write M.v.f, it is not always the case that the field f is > exported by the module M. Consider for example: > > module A = struct > type t = { f: int } > end > > module M = struct > open A > let v = { f = 1 } > type u = { f : string } > end > > print_int M.v.f > > This rightly fails (with a warning) as one should write M.v.A.f to be > fully precise about the scope. Note that M.v.M.f or M.(v.f) would have > a completely different (and wrong) meaning. Here is another example: module V2 = struct type t = { x:int; y:int; } let make x y = { x; y; } end module V3 = struct type t = { x:int; y:int; z:int; } let make x y z = { x; y; z; } let of_v2 v = { x = v.V2.x; y = v.V2.y; V3.z = 0; } let to_v2 v = { V2.x = v.x; V2.y = v.y; } end let v3_of_v2 v = { V3.x = v.V2.x; V3.y = v.V2.y; V3.z = 0; } MfG Goswin