From: John Gerard Malecki <johnm@vlibs.com>
To: caml-list@pauillac.inria.fr
Subject: Label Names Space - philosophy or implementation?
Date: Mon, 22 Jul 1996 17:40:16 -0700 (PDT) [thread overview]
Message-ID: <199607230040.RAA11401@owl.vlibs.com> (raw)
A co-worker has (vehemently) pointed out to me that record label names
cannot be shared. For example, the following fails
type foo = { name : string; x : int }
let a = { name = "foo"; x = 1 }
type bar = { name : string; y : float }
let b = { name = "bar"; y = 9. }
let a' = { name = "foo"; x = 2 }
With an error message on the last line that "The label x belongs to
the type foo but is here mixed with labels of type bar". This annoys
my co-worker to no end. He would like many of his records to have a
field with a standardized label. This makes it easier for him to
write printers for his data-structure. Does anyone have a
recommendation to make to him?
Until this morning I would have guessed that the type of a record was
not resolved until all of the labels were examined. As I re-read the
caml-light and ocaml manuals I see that this is not true.
Are there good reasons for this "restriction"? I can see how this
this might be considered a good software practice. Maybe, due to
pattern matching, it is not possible to have shared labels.
Any comments?
next reply other threads:[~1996-07-23 9:57 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
1996-07-23 0:40 John Gerard Malecki [this message]
1996-07-23 11:36 ` Pierre Weis
1996-07-24 7:37 ` pbrisset
1996-07-24 9:40 ` Xavier Leroy
1996-07-23 18:13 Andrew Conway
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=199607230040.RAA11401@owl.vlibs.com \
--to=johnm@vlibs.com \
--cc=caml-list@pauillac.inria.fr \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox