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!reader02.eternal-september.org!feeder.eternal-september.org!nntp-feed.chiark.greenend.org.uk!ewrotcd!newsfeed.xs3.de!io.xs3.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: making a son benefit access ton an instanciation of a generic package required as a formal parameter to his father and instanciated by him Date: Mon, 22 Jan 2018 19:23:48 -0600 Organization: JSA Research & Innovation Message-ID: References: <193126c2-f171-43ed-8c7c-00570f1dd4d4@googlegroups.com> <1eb1f57d-36fa-4bf0-8a40-5b32d71e5c28@googlegroups.com> Injection-Date: Tue, 23 Jan 2018 01:23:48 -0000 (UTC) Injection-Info: franka.jacob-sparre.dk; posting-host="rrsoftware.com:24.196.82.226"; logging-data="4201"; 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: reader02.eternal-september.org comp.lang.ada:50062 Date: 2018-01-22T19:23:48-06:00 List-Id: "Dmitry A. Kazakov" wrote in message news:p42tst$17l0$1@gioia.aioe.org... ... > It is a general problem with generics that something legal when compiling > it might turn legal or illegal depending on actual formal parameters. In > some cases Ada just ignores that, e.g. by treating things wrongly or in an > unexpected way, in other cases it tries to prevent that. It is an uphill > battle. There is no way to fix generics/templates/macros. To put this statement into language-lawyer terms, Ada generally uses "assume-the-best/assume-the-worst" when it comes to checking Legality Rules that depend on actual parameters. In a generic specification, the rules are checked "assume-the-best" and are rechecked when the generic is instantiated. In a generic body, the rules are checked "assume-the-worst". (Which means sometimes you can get rid of an error by moving a declaration into the private part of the specification.) For some rules, "assume-the-worst" would result in not allowing a feature at all. In such cases, the rules are checked with a dynamic check instead (typically, raising Program_Error if the code would have been illegal if not in a generic body). I'm not aware of any cases remaining where Ada just does the wrong thing, but Dmitry is correct that this has been a never-ending battle that tends to get repeated every time we invent a new feature. And of course, that's just the language. Compilers tend to get these rules wrong or simply forget to implement them, since they're uncommon. Which compounds the annoyances. (ACATS Test submissions are always welcome, especially in this area, presuming that there isn't already a test for the issue.) Randy.