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!nntp-feed.chiark.greenend.org.uk!ewrotcd!newsfeed.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: Why can't objects be static in Ada? Date: Mon, 15 Apr 2019 20:40:43 -0500 Organization: JSA Research & Innovation Message-ID: References: Injection-Date: Tue, 16 Apr 2019 01:40:44 -0000 (UTC) Injection-Info: franka.jacob-sparre.dk; posting-host="rrsoftware.com:24.196.82.226"; logging-data="27235"; 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; Original X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.7246 Xref: reader01.eternal-september.org comp.lang.ada:56134 Date: 2019-04-15T20:40:43-05:00 List-Id: wrote in message news:bc07b54c-0e86-4a40-931c-ca52d0295564@googlegroups.com... > For anyone interested, here is a minimal reproduction of what (i think) >is the OP's issue (the actual for the generic instantiation, not the >constant itself). > > > package Static is > pragma Preelaborate; I view this as self-inflicted, because there's no little value to pragma Preelaborate. As I previously noted, compilers will almost always generate the best possible elaboration code whether or not that pragma is applied. And regardless of C.4, not all preelaborated code can be done before load time, so it isn't providing a benefit in forcing that sort of code, either. It's one of the ideas where Ada tried to accomplish something, but didn't quite succeed. Pure is like that as well, but at least it provides some benefits for Annex E code. Preelaborate doesn't even do that. Especially when using GNAT and its static elaboration model (which eliminates elaboration checks from the equation -- that's the only benefit from using it in Janus/Ada). Randy.