comp.lang.ada
 help / color / mirror / Atom feed
From: Robert A Duff <bobduff@world.std.com>
Subject: Re: Redefining Integer Type ...
Date: 2000/10/18
Date: 2000-10-18T00:00:00+00:00	[thread overview]
Message-ID: <wcck8b640s8.fsf@world.std.com> (raw)
In-Reply-To: 9viH5.1415$cr1.226561@nnrp2.sbc.net

"Pat Rogers" <progers@NOclasswideSPAM.com> 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.




  reply	other threads:[~2000-10-18  0:00 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2000-10-18  0:00 Redefining Integer Type Arnaud de Muyser
2000-10-18  0:00 ` Robert A Duff
2000-10-18  0:00   ` Pat Rogers
2000-10-18  0:00     ` Robert A Duff [this message]
2000-10-18  0:00   ` Gautier
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox