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,bfbc780dd8e1c97c X-Google-Attributes: gid103376,public From: Stephen Leake Subject: Re: Question about generic formal derived types Date: 1999/03/31 Message-ID: #1/1 X-Deja-AN: 461289206 References: <7dpgl4$h2j$1@nnrp1.dejanews.com> <7drjqu$bq4$1@nnrp1.dejanews.com> Organization: NASA Goddard Space Flight Center -- Greenbelt, Maryland USA Newsgroups: comp.lang.ada Date: 1999-03-31T00:00:00+00:00 List-Id: adam@irvine.com writes: > In article , > Stephen Leake wrote: > > > > > After adding a spec for Pack4, running this thru ObjectAda 7.1.2 gives > > the error: > > > > adam.adb: Error: line 32 col 67 LRM:8.3(26), Illegal to override > > declaration in same region, Introducing new declaration anyway > > (In instance of generic Pack2 at adam.adb: line 13 col 9) > > > > I believe that answers all your questions :). > > > > -- Stephe > > I hope the smiley means you were kidding. Certainly, just running it through > a compiler and seeing what the compiler says doesn't really answer any > questions, since the Ada language rules are not determined by what a specific > compiler says they are or aren't. (This principle might not apply to other > languages. :-)) Besides, the error message doesn't say what "declaration" > it considers illegal, and the line number doesn't help because you had to add > some text to my fragment. Hmm, I wasn't kidding, although I didn't spend much time on it. I'd have spent more time if you had posted fully compilable code, and said what error your compiler gave. Since you didn't, I assumed you had no compiler, and simply provided the answer a compiler gives. I used ObjectAda, because it gives LRM references. I don't intend this as criticism, just as a suggestion on how to phrase future posts to more likely elicit the response you really want. > > > So after reading everything, it looks like the intent is to make this > instantiation illegal because of the name conflict, although it seems to be > the only way I can think of that a generic instantiation can be illegal for > this reason. This last makes me skeptical that this was what the language > designers intended, which is why I'm hoping for an "official" answer from > someone in the know (i.e. a human someone, not a compiler someone). Well, I'm not in a position to say anything authoritative. But my approach to understanding this would be "this would make no sense if it were legal, so how can I charitably read the LRM to make it illegal". Depending on why you want to know what the LRM says, this might be enough (it's enough for me :). If you're writing a compiler, you need more detail. -- Stephe