From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: weis Received: (from weis@localhost) by pauillac.inria.fr (8.7.6/8.7.3) id SAA18543 for caml-redistribution; Wed, 14 Jul 1999 18:07:23 +0200 (MET DST) 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 FAA07337 for ; Wed, 14 Jul 1999 05:10:15 +0200 (MET DST) Received: from iggy.triode.net.au (iggy.triode.net.au [203.63.235.1]) by nez-perce.inria.fr (8.8.7/8.8.7) with ESMTP id FAA06231 for ; Wed, 14 Jul 1999 05:10:13 +0200 (MET DST) Received: from egret (pm1-18.triode.net.au [203.63.235.34]) by iggy.triode.net.au (8.9.3/8.8.8) with SMTP id NAA32345; Wed, 14 Jul 1999 13:06:50 +1000 Message-Id: <3.0.6.32.19990714130436.00987970@mail.triode.net.au> X-Sender: skaller@mail.triode.net.au X-Mailer: QUALCOMM Windows Eudora Light Version 3.0.6 (32) Date: Wed, 14 Jul 1999 13:04:36 +1000 To: Dave Mason , caml-list@inria.fr From: John Skaller Subject: Re: irritability of structure name conflicts In-Reply-To: <199907131759.NAA00710@sarg.Ryerson.CA> References: Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Sender: weis At 13:59 13/07/99 -0400, Dave Mason wrote: >Is there some way I can force it to interpret the type constructor as >a particular type so that it chooses the labels from the correct set? This problem pervades ocaml. Another case of it is variants: type A = X | Y; type B = X | Z; which all compiles fine, but then X is a constructor for the B variant. C also has the same problem with enumerations: enum X {a,b,c}; /* a,b,c are globals */ The problem can be solved, clumbsily, by wrapping inside a module. (In C++, inside a class or namespace) While I'm also expressing irritation, when I compile a file (as opposed to using the interactive system); rebinding of symbols shouldn't be allowed: let a = 1;; ... let a = 1.0;; ... print_int a;; (* what does that strange type error mean! a is an integer! It is right there at the top of the file! *) Another similar case is open List open Map iter ... Woops! I meant List.iter, not Map.iter :-) There are several solutions, but the one that could be implemented now with least impact would be to issue warnings whenever a symbol is rebound in the same scope during batch compilation. (No warning in the interactive system; rebinding to fix mistakes is common) ------------------------------------------------------- John Skaller email: skaller@maxtal.com.au http://www.maxtal.com.au/~skaller phone: 61-2-96600850 snail: 10/1 Toxteth Rd, Glebe NSW 2037, Australia