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.9 required=5.0 tests=BAYES_00 autolearn=unavailable autolearn_force=no version=3.4.4 Path: eternal-september.org!reader01.eternal-september.org!feeder.eternal-september.org!gandalf.srv.welterde.de!news.jacob-sparre.dk!franka.jacob-sparre.dk!pnx.dk!.POSTED.rrsoftware.com!not-for-mail From: "Randy Brukardt" Newsgroups: comp.lang.ada Subject: Re: Good/best way to enforce library-level instantiation a generic package Date: Fri, 20 Mar 2020 15:37:59 -0500 Organization: JSA Research & Innovation Message-ID: References: <6bcc6133-8c8b-4252-a8e6-fd64a5eec2ca@googlegroups.com> Injection-Date: Fri, 20 Mar 2020 20:38:00 -0000 (UTC) Injection-Info: franka.jacob-sparre.dk; posting-host="rrsoftware.com:24.196.82.226"; logging-data="5114"; mail-complaints-to="news@jacob-sparre.dk" X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2900.5931 X-RFC2646: Format=Flowed; Response X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.7246 Xref: reader01.eternal-september.org comp.lang.ada:58220 Date: 2020-03-20T15:37:59-05:00 List-Id: "Jeffrey R. Carter" wrote in message news:r4sp9u$m59$1@dont-email.me... > On 3/18/20 2:03 AM, Randy Brukardt wrote: >> "Jeffrey R. Carter" 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.