From mboxrd@z Thu Jan 1 00:00:00 1970 Received: (from majordomo@localhost) by pauillac.inria.fr (8.7.6/8.7.3) id SAA07707; Tue, 11 May 2004 18:11:08 +0200 (MET DST) X-Authentication-Warning: pauillac.inria.fr: majordomo set sender to owner-caml-list@pauillac.inria.fr using -f Received: from concorde.inria.fr (concorde.inria.fr [192.93.2.39]) by pauillac.inria.fr (8.7.6/8.7.3) with ESMTP id SAA10293 for ; Tue, 11 May 2004 18:11:06 +0200 (MET DST) From: briand@aracnet.com Received: from citrine.spiritone.com (citrine.spiritone.com [216.99.193.133]) by concorde.inria.fr (8.12.10/8.12.10) with ESMTP id i4BGB4SH011538 for ; Tue, 11 May 2004 18:11:05 +0200 Received: from soggy.deldotd.com (216-99-206-32.cust.aracnet.com [216.99.206.32]) by citrine.spiritone.com (8.12.10/8.12.8) with ESMTP id i4BGAxOt027579; Tue, 11 May 2004 09:10:59 -0700 Received: from briand by soggy.deldotd.com with local (Exim 3.36 #1 (Debian)) id 1BNZqN-0000fm-00; Tue, 11 May 2004 09:10:59 -0700 MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Message-ID: <16544.64275.204812.673065@soggy.deldotd.com> Date: Tue, 11 May 2004 09:10:59 -0700 To: Ville-Pertti Keinonen Cc: caml-list@inria.fr Subject: Re: [Caml-list] duplicate record labels and modules In-Reply-To: <68643590-A31D-11D8-A8EF-000393863F70@exomi.com> References: <16544.24810.112188.634596@soggy.deldotd.com> <68643590-A31D-11D8-A8EF-000393863F70@exomi.com> X-Mailer: VM 6.92 under Emacs 21.2.1 X-Miltered: at concorde with ID 40A0FB18.000 by Joe's j-chkmail (http://j-chkmail.ensmp.fr)! X-Loop: caml-list@inria.fr X-Spam: no; 0.00; caml-list:01 foo:01 foo:01 printf:01 printf:01 verbose:01 kludgy:01 writes:01 labels:01 modules:02 modules:02 unbound:02 module:03 module:03 typing:03 Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk >>>>> "Ville-Pertti" == Ville-Pertti Keinonen writes: Ville-Pertti> On May 11, 2004, at 8:13 AM, briand@aracnet.com wrote: >> Consider the following : >> >> let a = {Foo.n1=1; Foo.n2=2; Foo.a=(- 1.0)} in >> let b = {Bar.n1=4; Bar.n2=(- 5); Bar.b=77.} in >> Printf.printf "%d\n" a.Foo.n1; >> Printf.printf "%d\n" b.Bar.n1; Ville-Pertti> If you want to make it slightly less verbose, you can say Ville-Pertti> module F = Foo Ville-Pertti> module B = Bar Ville-Pertti> Or you could use "let module ... in". That's useful. I need to read the chapter on language extensions more closely. Ville-Pertti> Alternately, assuming the modules are your own, you Ville-Pertti> can name your record fields so that opening both Ville-Pertti> modules doesn't cause conflicts (e.g. using a short Ville-Pertti> prefix). That's very kludgy, isn't it ? I'm assuming the right way is to use modules, which is what started this whole exercise for me. >> let (a:Foo.t) = {n1=1; n2=2; a=(- 1.0)} in >> >> Unbound record field label n1 >> >> After careful review of the grammar I discovered that is incorrect, >> although it seems like it should work. Ville-Pertti> Nothing about "a" affects the meaning of the Ville-Pertti> expression on the right hand side of the "=". Ville-Pertti> Even if it did, the visibility of identifiers is Ville-Pertti> determined only by lexical scope, typing has no Ville-Pertti> effect, which is why even if you have "a:Foo.t" in Ville-Pertti> scope, you can't access "a.n1". Oh yes. That makes makes sense. Thanks for your help. Brian ------------------- To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/ Beginner's list: http://groups.yahoo.com/group/ocaml_beginners