caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
* Record field label locality
@ 2008-08-10 10:04 Brighten Godfrey
  2008-08-10 19:38 ` [Caml-list] " Jon Harrop
  0 siblings, 1 reply; 11+ messages in thread
From: Brighten Godfrey @ 2008-08-10 10:04 UTC (permalink / raw)
  To: caml-list

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


^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2008-08-14 10:23 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-08-10 10:04 Record field label locality Brighten Godfrey
2008-08-10 19:38 ` [Caml-list] " Jon Harrop
2008-08-12 21:03   ` Brighten Godfrey
2008-08-13  0:12     ` Edgar Friendly
2008-08-13  1:17       ` Brighten Godfrey
2008-08-13 12:48         ` Edgar Friendly
2008-08-14  6:38           ` Brighten Godfrey
2008-08-14 10:11             ` David Allsopp
2008-08-13  1:51     ` blue storm
2008-08-13  8:14     ` Richard Jones
2008-08-13  9:30       ` Brighten Godfrey

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).