comp.lang.ada
 help / color / mirror / Atom feed
From: Stephen Leake <Stephen.Leake@gsfc.nasa.gov>
Subject: Re: Question about generic formal derived types
Date: 1999/03/31
Date: 1999-03-31T00:00:00+00:00	[thread overview]
Message-ID: <ur9q5ifkw.fsf@gsfc.nasa.gov> (raw)
In-Reply-To: 7drjqu$bq4$1@nnrp1.dejanews.com

adam@irvine.com writes:

> In article <uemm6suip.fsf@gsfc.nasa.gov>,
>   Stephen Leake <Stephen.Leake@gsfc.nasa.gov> 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.

> <snip rummaging thru LRM>
> 
> 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




  reply	other threads:[~1999-03-31  0:00 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1999-03-30  0:00 Question about generic formal derived types adam
1999-03-30  0:00 ` Steve Quinlan
1999-03-30  0:00 ` Stephen Leake
1999-03-30  0:00   ` adam
1999-03-31  0:00     ` Stephen Leake [this message]
1999-03-31  0:00   ` robert_dewar
replies disabled

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