From mboxrd@z Thu Jan 1 00:00:00 1970 Received: (from weis@localhost) by pauillac.inria.fr (8.6.10/8.6.6) id LAA06268 for caml-redistribution; Tue, 23 Jul 1996 11:57:09 +0200 Received: from concorde.inria.fr (concorde.inria.fr [192.93.2.39]) by pauillac.inria.fr (8.6.10/8.6.6) with ESMTP id DAA04048 for ; Tue, 23 Jul 1996 03:29:31 +0200 Received: from netcomsv.netcom.com (uucp11.netcom.com [163.179.3.11]) by concorde.inria.fr (8.7.1/8.7.1) with SMTP id DAA00251 for ; Tue, 23 Jul 1996 03:29:28 +0200 (MET DST) Received: by netcomsv.netcom.com with UUCP (8.6.12/SMI-4.1) id SAA04650; Mon, 22 Jul 1996 18:22:19 -0700 Received: from owl.vlibs.com (owl.vlibs.com [192.149.105.6]) by pup.vlibs.com (8.7.4/8.7.3) with ESMTP id RAA03127 for ; Mon, 22 Jul 1996 17:40:17 -0700 (PDT) Received: (from johnm@localhost) by owl.vlibs.com (8.7.4/8.7.3) id RAA11401; Mon, 22 Jul 1996 17:40:16 -0700 (PDT) Date: Mon, 22 Jul 1996 17:40:16 -0700 (PDT) Message-Id: <199607230040.RAA11401@owl.vlibs.com> From: John Gerard Malecki To: caml-list@pauillac.inria.fr Subject: Label Names Space - philosophy or implementation? X-Organization: VLSI Libraries Incorporated Sender: weis 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?