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,93dce172c8d3e2fb X-Google-Attributes: gid103376,public From: bobduff@world.std.com (Robert A Duff) Subject: Re: Which compiler is correct? Date: 1997/06/21 Message-ID: #1/1 X-Deja-AN: 251476054 References: <33A77C54.5484@bix.com> Organization: The World Public Access UNIX, Brookline, MA Newsgroups: comp.lang.ada Date: 1997-06-21T00:00:00+00:00 List-Id: In article , Simon Wright wrote: >a.c's body can see the full view of type a.x >a.c's body can only see the partial view of type a.b.y >the partial view of type a.b.y says it's a new a.x >so how come the a.x bits of a.b.y aren't visible to a.c's body? Because the RM says so. ;-) >(I'm sure it's true if you say so; I just think most people, after >they've seen this sort of problem and fumbled their way to a >resolution a few times, will have a private spellbook from which they >will select incantations until they find one that works. So what's >new, you say) The idea here, is that when you say "type New_Type is new Old_Type ...", the properties of New_Type are frozen at that point. EXCEPT when this declaration is inside where Old_Type is declared -- then, at the earliest place within New_Type's immediate scope where it can see some additional information about Old_Type, then that information becomes visible for New_Type. Usually, this doesn't happen. When it does happen, it's either at the beginning of a private part of a child package, or at the beginning of the body of a physically-nested package. Yes, this leads to surprising consequences, like where you're at a place that *knows* New_Type is derived from Old_Type, and *knows* that Old_Type has a component Foo, but nonetheless, Foo is not a visible component of New_Type. This can be confusing, but at least the confusion happens at compile time, not at run time. :-) - Bob