comp.lang.ada
 help / color / mirror / Atom feed
From: "Randy Brukardt" <randy@rrsoftware.com>
Subject: Re: Good/best way to enforce library-level instantiation a generic package
Date: Fri, 20 Mar 2020 15:37:59 -0500
Date: 2020-03-20T15:37:59-05:00	[thread overview]
Message-ID: <r539j8$4vq$1@franka.jacob-sparre.dk> (raw)
In-Reply-To: r4sp9u$m59$1@dont-email.me

"Jeffrey R. Carter" <spam.jrcarter.not@spam.not.acm.org> wrote in message 
news:r4sp9u$m59$1@dont-email.me...
> On 3/18/20 2:03 AM, Randy Brukardt wrote:
>> "Jeffrey R. Carter" <spam.jrcarter.not@spam.not.acm.org> wrote in message
>> news:r4qbs8$192$1@dont-email.me...
>>>
>>> type T is abstract tagged null record;
>>> Name : constant String := Ada.Tags.Expanded_Name (T);
>>> pragma Assert
>>>     (Ada.Strings.Fixed.Index (Name (Name'First .. Name'Last - 2), ".") = 
>>> 0,
>>>      "Generic_Name must be instantiated at library level");
>>
>> That would reject an instance in a library-level child package, which
>> probably isn't what the OP wants.
>
> An instance IN a child pkg is not a library-level instance, so the OP 
> would want to reject it. But an instance AS a library-level child pkg 
> would be rejected, so this doesn't work.

??? Any declaration in a library-level *package* is a library-level 
declaration. That's not true for other kinds units, of course. 3.10.2(22) 
explains that "library-level" is determined by the accessibility of a 
declaration, and a declaration in a package has the same accessibility as 
the package.

                          Randy.


  reply	other threads:[~2020-03-20 20:37 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-03-16 18:51 Good/best way to enforce library-level instantiation a generic package Vincent Marciante
2020-03-17  1:21 ` Randy Brukardt
2020-03-17 10:11   ` Vincent Marciante
2020-03-17 11:21   ` Jeffrey R. Carter
2020-03-18  1:03     ` Randy Brukardt
2020-03-18  9:23       ` Jeffrey R. Carter
2020-03-20 20:37         ` Randy Brukardt [this message]
2020-03-18 10:27       ` Vincent Marciante
2020-03-17  6:29 ` briot.emmanuel
2020-03-17 10:15   ` Vincent Marciante
replies disabled

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