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.109.56.254.145.mobile.3.dk!not-for-mail From: Jacob Sparre Andersen Newsgroups: comp.lang.ada Subject: Re: Ada conditional compilation and program variants Date: Mon, 07 May 2018 10:41:48 +0200 Organization: JSA Research & Innovation Message-ID: <87in7zuab7.fsf@jacob-sparre.dk> References: <1b44444f-c1b3-414e-84fb-8798961487c3@googlegroups.com> <62ee0aac-49da-4925-b9aa-a16695b3fc45@googlegroups.com> <9879872e-c18a-4667-afe5-41ce0f54559f@googlegroups.com> <0520137a-4d39-440f-931b-b41c880c49d4@googlegroups.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Injection-Info: franka.jacob-sparre.dk; posting-host="109.56.254.145.mobile.3.dk:109.56.254.145"; logging-data="4716"; mail-complaints-to="news@jacob-sparre.dk" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.4 (gnu/linux) Cancel-Lock: sha1:XeYiKvvQgFNLFeVE7/MuYVAWzqs= Xref: reader02.eternal-september.org comp.lang.ada:52065 Date: 2018-05-07T10:41:48+02:00 List-Id: Niklas Holsti wrote: > An interesting question is this: if package declaration or body B uses > package A, and package A has a definition, how far can a compiler > check that B uses A in legal ways if the compiler is allowed to look > only at the definition of A, but not at the (or a) declaration of A? > > If the compiler could check legality using only the package > definitions of server packages, it would make it easier to ensure that > all program variants are legal, by two separate and non-combinatorial > steps: > > - checking each variant package declaration against the (invariant) > package definition, and > > - checking each variant package body against the (invariant) package > definitions of all other packages (those used by this body). > > If checking the legality of how B uses A requires looking at the > declaration of A (and not only at the definition of A), there is again > a risk of combinatorial explosion in checking the legality of all > (complete) program variants when there are variant package > declarations. The only counter-examples I've been able to come up with so far are run-time errors, such as going beyond the range of a numerical type. What about enumeration types? Should it be allowed to declare names for some, but not all values of an enumeration type? One could of course declare a function returning a value of the type in the package definition, and say that it can be implemented in the package declaration as an enumeration value. - Can't do that for characters though, so maybe it is a bad idea. Greetings, Jacob -- "Genes don't matter. It's all physics."