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 HAA09412; Tue, 11 May 2004 07:13:22 +0200 (MET DST) X-Authentication-Warning: pauillac.inria.fr: majordomo set sender to owner-caml-list@pauillac.inria.fr using -f Received: from nez-perce.inria.fr (nez-perce.inria.fr [192.93.2.78]) by pauillac.inria.fr (8.7.6/8.7.3) with ESMTP id HAA09746 for ; Tue, 11 May 2004 07:13:21 +0200 (MET DST) From: briand@aracnet.com Received: from obsidian.spiritone.com (obsidian.spiritone.com [216.99.193.137]) by nez-perce.inria.fr (8.12.10/8.12.10) with ESMTP id i4B5DKEV011644 for ; Tue, 11 May 2004 07:13:20 +0200 Received: from soggy.deldotd.com (216-99-206-32.cust.aracnet.com [216.99.206.32]) by obsidian.spiritone.com (8.12.10/8.12.8) with ESMTP id i4B5DJJG029437 for ; Mon, 10 May 2004 22:13:19 -0700 Received: from briand by soggy.deldotd.com with local (Exim 3.36 #1 (Debian)) id 1BNPZq-0000Xj-00 for ; Mon, 10 May 2004 22:13:14 -0700 MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Message-ID: <16544.24810.112188.634596@soggy.deldotd.com> Date: Mon, 10 May 2004 22:13:14 -0700 To: caml-list@inria.fr Subject: [Caml-list] duplicate record labels and modules X-Mailer: VM 6.92 under Emacs 21.2.1 X-Miltered: at nez-perce with ID 40A060F0.000 by Joe's j-chkmail (http://j-chkmail.ensmp.fr)! X-Loop: caml-list@inria.fr X-Spam: no; 0.00; foo:01 foo:01 printf:01 printf:01 verbose:01 perusing:01 expr:01 expr:01 annotating:01 1....:99 labels:01 labels:01 lazy:02 modules:02 unbound:02 Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk 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; That's too verbose, and I can't use open or I get the dreaded mixing labels problem. So how about: 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. A little more perusing and I found: let-binding ::= pattern = expr | value-name { parameter } [: typexpr] = expr and that makes sense. I'm simply explictly annotating the type of a, right ? So I tried: let a:Foo.t = {n1=1; n2=2; a=(- 1.0)} in And got the same error, i.e. unbound field n1.... I'm doing a lot of work so I can be lazy :-) Thanks 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