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 20A5ABB84 for ; Sun, 10 Aug 2008 12:04:53 +0200 (CEST) X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AukCAPBZnkip5TxXiGdsb2JhbACRVwEBAQ8glzU X-IronPort-AV: E=Sophos;i="4.31,337,1215381600"; d="scan'208";a="28106432" Received: from gateway0.eecs.berkeley.edu ([169.229.60.87]) by mail4-smtp-sop.national.inria.fr with ESMTP/TLS/DHE-RSA-AES256-SHA; 10 Aug 2008 12:04:51 +0200 Received: from [10.0.1.5] (136-152-208-15.VPN.Berkeley.EDU [136.152.208.15]) (authenticated bits=0) by gateway0.EECS.Berkeley.EDU (8.14.3/8.13.5) with ESMTP id m7AA4lpJ007259 (version=TLSv1/SSLv3 cipher=AES128-SHA bits=128 verify=NOT) for ; Sun, 10 Aug 2008 03:04:48 -0700 (PDT) Mime-Version: 1.0 (Apple Message framework v753.1) Content-Transfer-Encoding: 7bit Message-Id: Content-Type: text/plain; charset=US-ASCII; delsp=yes; format=flowed To: caml-list@yquem.inria.fr From: Brighten Godfrey Subject: Record field label locality Date: Sun, 10 Aug 2008 03:04:37 -0700 X-Mailer: Apple Mail (2.753.1) X-Spam: no; 0.00; locality:01 ocaml:01 nodes:01 node:01 avoided:01 compiler:01 nodes:01 unambiguous:01 graph:01 graph:01 naming:01 define:02 seems:03 module:03 module:03 Hi, Here's something that I've wondered about for years; maybe someone here can enlighten me. One of the few major annoyances in OCaml code style is that if I define a record in one module, say a Graph module: type t = { nodes : node_t array; } then when I use it in another module, say with a graph variable `g', then I have to write `g.Graph.nodes' rather than `g.nodes'. I can understand why a record field label has to be uniquely identified. But can't the explicit naming of the Graph module usually be avoided, since the compiler will know that `g' is a `Graph.t'? For example if I write something like let g : Graph.t = make_graph () in g.nodes it seems to me that on the second line, the type of `g' and hence the meaning of `g.nodes' is unambiguous. Thanks! ~Brighten Godfrey