comp.lang.ada
 help / color / mirror / Atom feed
From: "Dmitry A. Kazakov" <mailbox@dmitry-kazakov.de>
Subject: Re: Stupid question
Date: Fri, 13 Apr 2007 10:20:34 +0200
Date: 2007-04-13T10:20:34+02:00	[thread overview]
Message-ID: <1pyl2asiynhjs.117mopb54gcj7$.dlg@40tude.net> (raw)
In-Reply-To: 1176415338.362267.115580@l77g2000hsb.googlegroups.com

On 12 Apr 2007 15:02:18 -0700, Adam Beneschan wrote:

> I wrote:
> 
>> On Apr 12, 1:05 pm, "Dmitry A. Kazakov" <mail...@dmitry-kazakov.de>
>> wrote:
>>
>>> generic
>>> package A is
>>>    A1 : Integer;
>>> end A;
>>
>>> generic
>>> package A.B is
>>> end A.B;
>>
>>> with A.B;
>>> generic
>>>    with package A_B is new A.B (<>);
>>> package C is
>>>    -- What is the name of A1 from A of A_B?
>>> end C;
>>
>> I am betting that if you try to compile just the code snippet you've
>> got, you will figure out your answer.
> 
> Sorry about that answer.  I made the rash assumption that you would be
> using a compiler that works.  But apparently that's not necessarily
> the case.
> 
> The version of GNAT I've got installed compiles the above code with no
> errors, despite the fact that it's illegal.  I was assuming that you'd
> get an error and the error would help you figure out what was wrong;
> but I didn't figure on this happening.

[OK, GNAT has *lots* of problems with generics, it always had. I wonder
when AdaCore would finally decide to rewrite generics from scrap. But
that's aside.]

Are you saying that it is illegal to refer to generic children of generic
packages as generic packages? I don't see where 12.7 states it. 12.7(4):

"The generic_package_name shall denote a generic package (the template for
the formal package); the formal package is an instance of the template."

A.B is definitely a generic package to me.

> The problem is that you cannot refer to A.B the way you did in your
> "with package" declaration; you can only refer to A_Inst.B where
> A_Inst is an instance of A (A_Inst could be another generic formal
> package).

Well, you mean that dreadful:

with A.B;
generic
    with package A_Inst is new A (<>);
    with package A_B_Inst is new A_Inst.B (<>);
package C is
end C;

This what I am trying to avoid. It is awful (and GNAT has problems with the
constructs like that). 

-- 
Regards,
Dmitry A. Kazakov
http://www.dmitry-kazakov.de



  reply	other threads:[~2007-04-13  8:20 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-04-12 20:05 Stupid question Dmitry A. Kazakov
2007-04-12 21:40 ` Adam Beneschan
2007-04-12 22:02   ` Adam Beneschan
2007-04-13  8:20     ` Dmitry A. Kazakov [this message]
2007-04-13 13:53       ` Anh Vo
2007-04-13 15:35       ` Adam Beneschan
2007-04-13 17:12         ` Dmitry A. Kazakov
2007-04-13 18:14           ` Adam Beneschan
2007-04-13 18:50             ` Adam Beneschan
2007-04-13 19:01           ` Randy Brukardt
2007-04-13 19:33             ` Markus E Leypold
2007-04-13 23:39               ` Randy Brukardt
2007-04-14  7:25                 ` Dmitry A. Kazakov
  -- strict thread matches above, loose matches on Subject: below --
2003-10-08  3:12 stupid question Shanon Fernald
2003-10-08  3:31 ` James Rogers
2003-10-08  4:34 ` Steve
2003-10-08 12:54   ` Marin David Condic
2003-10-08 13:01 ` Marin David Condic
2003-10-08 22:18 ` Robert I. Eachus
2003-10-09 10:09   ` Steffen Huber
2003-10-10 16:02     ` Robert I. Eachus
replies disabled

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