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 mail3-relais-sop.national.inria.fr (mail3-relais-sop.national.inria.fr [192.134.164.104]) by sympa.inria.fr (Postfix) with ESMTPS id 44C167EEBF for ; Tue, 18 Aug 2015 14:52:21 +0200 (CEST) Received-SPF: None (mail3-smtp-sop.national.inria.fr: no sender authenticity information available from domain of dra-news@metastack.com) identity=pra; client-ip=62.13.148.102; receiver=mail3-smtp-sop.national.inria.fr; envelope-from="dra-news@metastack.com"; x-sender="dra-news@metastack.com"; x-conformance=sidf_compatible Received-SPF: Pass (mail3-smtp-sop.national.inria.fr: domain of dra-news@metastack.com designates 62.13.148.102 as permitted sender) identity=mailfrom; client-ip=62.13.148.102; receiver=mail3-smtp-sop.national.inria.fr; envelope-from="dra-news@metastack.com"; x-sender="dra-news@metastack.com"; x-conformance=sidf_compatible; x-record-type="v=spf1" Received-SPF: None (mail3-smtp-sop.national.inria.fr: no sender authenticity information available from domain of postmaster@outmail148102.authsmtp.net) identity=helo; client-ip=62.13.148.102; receiver=mail3-smtp-sop.national.inria.fr; envelope-from="dra-news@metastack.com"; x-sender="postmaster@outmail148102.authsmtp.net"; x-conformance=sidf_compatible X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: A0BZAQBGKdNVnGaUDT5dgm+Bb6ocBptUAoEtTAEBAQEBARIBAQEBAQgLCQkhLoQjAQEBBAM3TwIBCBgKFBAyJQIEARqIJwPRJgEBCAEBAQEBARyGIIUyhFg4gxiBFAWVIIxsAZougjQcgVOCOYEEAQEB X-IPAS-Result: A0BZAQBGKdNVnGaUDT5dgm+Bb6ocBptUAoEtTAEBAQEBARIBAQEBAQgLCQkhLoQjAQEBBAM3TwIBCBgKFBAyJQIEARqIJwPRJgEBCAEBAQEBARyGIIUyhFg4gxiBFAWVIIxsAZougjQcgVOCOYEEAQEB X-IronPort-AV: E=Sophos;i="5.15,701,1432591200"; d="scan'208";a="143061048" Received: from outmail148102.authsmtp.net ([62.13.148.102]) by mail3-smtp-sop.national.inria.fr with ESMTP; 18 Aug 2015 14:52:20 +0200 Received: from mail-c235.authsmtp.com (mail-c235.authsmtp.com [62.13.128.235]) by punt16.authsmtp.com (8.14.2/8.14.2/) with ESMTP id t7ICqJJG091703; Tue, 18 Aug 2015 13:52:19 +0100 (BST) Received: from romulus.metastack.com (114.212-105-213.static.virginmediabusiness.co.uk [213.105.212.114]) (authenticated bits=0) by mail.authsmtp.com (8.14.2/8.14.2/) with ESMTP id t7ICqIWo070817; Tue, 18 Aug 2015 13:52:18 +0100 (BST) Received: from remus.metastack.local (remus.metastack.com [172.16.0.1]) by romulus.metastack.com (8.14.2/8.14.2) with ESMTP id t7ICqH5N023648 (version=TLSv1/SSLv3 cipher=AES128-SHA bits=128 verify=FAIL); Tue, 18 Aug 2015 13:52:17 +0100 Received: from Remus.metastack.local ([fe80::547c:3c42:e1da:eda2]) by Remus.metastack.local ([fe80::547c:3c42:e1da:eda2%10]) with mapi id 14.03.0248.002; Tue, 18 Aug 2015 13:52:17 +0100 From: David Allsopp To: Goswin von Brederlow , "caml-list@inria.fr" Thread-Topic: [Caml-list] destructive local opens Thread-Index: AQHQzfGxmRSp9w+XzkW+YFY+A2QltZ36OIoAgAAAygCAABsMy4ABLkgAgAADZgCAAC7JgIAADZaAgA+QfYCAAAk3AIAGRIAAgAAp+eA= Date: Tue, 18 Aug 2015 12:52:16 +0000 Message-ID: References: <55BF75F6.1040006@bioquant.uni-heidelberg.de> <8E1A640CE3374EB492981ADB0A2DA5C6@erratique.ch> <20150804092633.GC5689@frosties> <5C2023F4AF0549F58F3E4C9A6F8ABE84@erratique.ch> <20150814105551.GD31364@frosties> <55CDD0F2.1090200@zoho.com> <20150818111134.GA11154@frosties> In-Reply-To: <20150818111134.GA11154@frosties> Accept-Language: en-GB, en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [83.115.140.152] Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Organization: MetaStack Solutions Ltd. X-Scanned-By: MIMEDefang 2.65 on 172.16.0.20 X-Server-Quench: f5cf002f-45a7-11e5-b398-002590a15da7 X-AuthReport-Spam: If SPAM / abuse - report it at: http://www.authsmtp.com/abuse X-AuthRoute: OCd1ZAARAlZZVg1f DC4bFwdFRBksPQFF ChxFJgxfNl8UURhQ KkJXbgASJgRMAnhE VHkJW1VRQFxyU2Z3 YQtYIwdcYVRPXwB0 UklLXFNTEBpqBAMB SFoZK2ozDmIZeHlw bUdlEHdbWkA0I0Mu FE5UFzsbYWIxb30e URVdalFXeQtXfh9H b1l/BXIINTQAKBgV TUcAFDk0OXBbKT9J d0kBIEkOW1sAAj8i SlgGGj4mGQUCXyg1 NHQA X-Authentic-SMTP: 61633634383431.1023:706 X-AuthFastPath: 0 (Was 255) X-AuthSMTP-Origin: 213.105.212.114/25 X-AuthVirus-Status: No virus detected - but ensure you scan with your own anti-virus system. Subject: RE: [Caml-list] destructive local opens Goswin von Brederlow wrote: > On Fri, Aug 14, 2015 at 01:28:50PM +0200, Drup wrote: > > > > >You can't qualifylocal values or values of the surrounding module so > > >that is a no go. > > > > > >I also often use local open to access records, as in: > > > > > >let r =3D M.({ x =3D 1; y; z =3D depth; }) in > > > > You can avoid the local open altogether and write it like that: > > > > let r =3D {M. x =3D 1; y; z =3D depth } in > > > > It's even shorter. >=20 > That only works because newer ocaml disambiguises (is that a word?) record > So it's implicitly using M.y =3D y and M.z =3D depth. > labels when it determines the record type from the first label, right? Only since you ask: "disambiguates" :o) That said, it's quite common to see= words like "disambiguises" being invented by Americans! But this isn't related to the disambiguation features of OCaml 4.01+. Those= allow you to write things like: type t =3D {x : int} type u =3D {x : int; y : string} let foo =3D {x =3D 1} let bar =3D {x =3D 42; y =3D ""} This is actually a much older notation added in OCaml 3.08. Prior to that, = if you hadn't opened a module you had to qualify each label: {M.x =3D 1; M.y =3D y; M.z =3D depth} but this was "silly", since it's not possible to use non-equivalent module = paths for labels, so OCaml 3.08 changed it so that you only needed to put t= he module path on one label (and it doesn't have to be the first one, it's = just a bit weird to put it in the middle!). OCaml 3.12 added, amongst other record-related goodies, the shorthand {y} t= o mean {y =3D y}. So while you can use local open as you're using it, you'v= e been able to do it as a totally unambiguous language feature for quite so= me time. David=20