From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.3 required=5.0 tests=BAYES_00,INVALID_MSGID autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,1c4a54744b1a13e2 X-Google-Attributes: gid103376,public From: Robert A Duff Subject: Re: Redefining Integer Type ... Date: 2000/10/18 Message-ID: #1/1 X-Deja-AN: 682931652 Sender: bobduff@world.std.com (Robert A Duff) References: <39ED8FE6.3F7CF3B9@attol-testware.com> <9viH5.1415$cr1.226561@nnrp2.sbc.net> Organization: The World Public Access UNIX, Brookline, MA Newsgroups: comp.lang.ada Date: 2000-10-18T00:00:00+00:00 List-Id: "Pat Rogers" writes: > > I don't like that rule -- it's error prone, as you can see. > > Hiding considered harmful. > > But there is a benefit to the rule that use-visible names don't hide > names that are already visible -- a use clause added later won't > change the meaning of an existing bit of code. That's exactly my point. Hiding is Harmful. The rule about use clauses is Good, because it does *not* introduce hiding (between use-vis things). The problem is that nested declarations can hide use-vis things: package Parent is X: Integer; end Parent; ... -- several levels package Something_Else is X: Integer; end Something_Else; package Parent.Child.Grandchild.Greatgrandchild is use Something_Else; ... -- which X is visible here? The programmer might think it's Something_Else.X, but it's actually Parent.X. The good rule about use-clauses should be extended to everything: there should be no hiding, period. >... Granted it can be > confusing with the names declared within Standard, Not just Standard, as illustrated above. Any outer name can hide a use-visible name, and any outer name can hide an inner name. Both forms of hiding are bad. >... but overall it > seems worth the price, especially given that declaring names identical > to those in Standard seems confusing anyway. But the purpose of the rules is to *prevent* confusion! - Bob P.S. I hope nobody thinks I'm suggesting changes to Ada. It can't be changed in an upward incompatible way. I'm talking about language design more generally.