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=ham autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,5265ce03ee8f5252 X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2001-01-07 05:10:50 PST Path: supernews.google.com!sn-xit-02!supernews.com!nntp-relay.ihug.net!ihug.co.nz!news-spur1.maxwell.syr.edu!news.maxwell.syr.edu!colt.net!newsfeed00.sul.t-online.de!t-online.de!grolier!club-internet!not-for-mail From: Laurent Guerby Newsgroups: comp.lang.ada Subject: Re: Ok sorry, it is just a book gives no feedback. Date: 07 Jan 2001 14:09:11 +0100 Organization: Club-Internet (France) Message-ID: <86snmvv79k.fsf@acm.org> References: <931r2l$4ai5t$2@ID-25716.news.dfncis.de> <931t08$5u5$1@nnrp1.deja.com> <932632$e0e$1@nnrp1.deja.com> <932an8$ijs$1@nnrp1.deja.com> <93421h$2ju$1@nnrp1.deja.com> <934j5c$eu9$1@nnrp1.deja.com> <86hf3c5ure.fsf@acm.org> <937vl0$5gs$1@nnrp1.deja.com> NNTP-Posting-Host: nas22-41.vlt.club-internet.fr X-Trace: front5m.grolier.fr 978872805 4068 195.36.172.41 (7 Jan 2001 13:06:45 GMT) NNTP-Posting-Date: 7 Jan 2001 13:06:45 GMT X-Newsreader: Gnus v5.7/Emacs 20.5 Xref: supernews.google.com comp.lang.ada:3742 Date: 2001-01-07T13:06:45+00:00 List-Id: Robert Dewar writes: > Laurent Guerby wrote: > > The trick is to use pragma Import in Pure units to import > > "unpure" debugging stuff without withing it. > > Sshhhh! This is a secret trick that should not be revealed to > the uninitiated :-) :-) ;-) > Few Ada programmers realize what a huge hole this is in the > language (introduced in Ada 95 with the formal recognition of > Ada as a convention). > > You can do all *sorts* of things by using pragma Import and > Export with convention Ada. You can completely disconnect type > checking at the subprogram call interface. You can compeltely > disconnect elaboration order checking in elaboration code etc. > You can also bypass any "silly" rules that you don't like about > what you can and cannot WITH. > > I wonder whether we realized what a big hole we were creating > there. I very seldom favor absolute rules in coding standards, > so I hesitate to say *never* use convention Ada in this manner, > but for sure you have to be super careful, it is as bad or > worse than any of the unchecked interfaces in the language, and > does not clearly announce itself, since the Import can be > buried deep in the implementation code. I think the language designers did not realize this, at least that's what I infer from reactions when I posted this trick circa 1995 (IIRC) in comp.lang.ada. In the "break everything" area you also have stream based code which does all sorts of "unchecked" stuff without having "unchecked" in its name (well it's obvious, but it breaks the "grep Unchecked" rule ;-). Another marginal use of pragma "Import Ada" is to portably disable (I guess in most implementations ;-) global optimizations. If you want for example to benchmark a piece of code with inlining on, but don't want some stuff to be inlined, or to have a smart compiler computing everything at compile time via global analysis, just "Import Ada" the given stuff. -- Laurent Guerby