From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.1.3 (2006-06-01) on yquem.inria.fr X-Spam-Level: * X-Spam-Status: No, score=1.1 required=5.0 tests=AWL,SPF_SOFTFAIL autolearn=disabled version=3.1.3 Received: from mail4-relais-sop.national.inria.fr (mail4-relais-sop.national.inria.fr [192.134.164.105]) by yquem.inria.fr (Postfix) with ESMTP id D83D3BB84 for ; Wed, 13 Aug 2008 11:30:16 +0200 (CEST) X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AiADALRGokip5TxXiGdsb2JhbACRdwEBAQ8gnXCHA0CBVQ X-IronPort-AV: E=Sophos;i="4.32,200,1217800800"; d="scan'208";a="28187691" Received: from gateway0.eecs.berkeley.edu ([169.229.60.87]) by mail4-smtp-sop.national.inria.fr with ESMTP/TLS/DHE-RSA-AES256-SHA; 13 Aug 2008 11:30:16 +0200 Received: from [10.0.1.5] (136-152-208-53.VPN.Berkeley.EDU [136.152.208.53]) (authenticated bits=0) by gateway0.EECS.Berkeley.EDU (8.14.3/8.13.5) with ESMTP id m7D9Twel028467 (version=TLSv1/SSLv3 cipher=AES128-SHA bits=128 verify=NOT); Wed, 13 Aug 2008 02:30:04 -0700 (PDT) Mime-Version: 1.0 (Apple Message framework v753.1) In-Reply-To: <20080813081459.GA30690@annexia.org> References: <200808102038.40534.jon@ffconsultancy.com> <20080813081459.GA30690@annexia.org> Content-Type: text/plain; charset=US-ASCII; delsp=yes; format=flowed Message-Id: Content-Transfer-Encoding: 7bit From: Brighten Godfrey Subject: Re: [Caml-list] Record field label locality Date: Wed, 13 Aug 2008 02:30:02 -0700 To: Richard Jones , blue storm , Jon Harrop , OCaml List X-Mailer: Apple Mail (2.753.1) X-Spam: no; 0.00; locality:01 annotations:01 ocaml:01 ocaml:01 compiler:01 inference:01 undecidable:01 ocaml's:01 nodes:01 nodes:01 'open:01 graph':01 trade-offs:01 frisch:01 camlp:01 On Aug 13, 2008, at 1:14 AM, Richard Jones wrote: > On Tue, Aug 12, 2008 at 02:03:46PM -0700, Brighten Godfrey wrote: >> I think I see what you're getting at. Is it possible to define >> compositionality as follows?: > > I think Jon means that you can copy and paste code around and it still > works. (...which is not true for various other reasons (e.g. conflicting type annotations, variables with different types, etc.).) >> "Removing a type annotation from >> correct OCaml code results in correct OCaml code." > > This is mostly correct. However very occasionally it is necessary to > help the compiler out by annotating expressions with types. I believe > this is because type inference used by OCaml is undecidable. You'll > notice this effect more often if you use OCaml's object system. Yes, I've noticed that. > You might want to try renaming the Graph module, ie: > > module G = Graph > > ... g.G.nodes ... > > Or if you have control over the module itself, you could also try > renaming the fields to make them unique (eg. g_nodes), at which point > you can just 'open Graph'. There are different trade-offs to each > approach. On Aug 12, 2008, at 6:51 PM, blue storm wrote: > It might be a bit off-topic, but if you want to ease the syntaxic > pain only, you can use the pa_openin (http://alain.frisch.fr/ > soft.html#openin ) camlp4 extension : > > open Graph in { g with nodes = foo } Thanks to both of you for suggesting these workarounds. Probably renaming the module is the easiest and least likely to cause other problems. I am still curious about the language design question though... Thanks, ~Brighten