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=-0.9 required=5.0 tests=BAYES_00,FORGED_GMAIL_RCVD, FREEMAIL_FROM autolearn=no autolearn_force=no version=3.4.4 X-Google-Thread: 103376,634259facc42df7a X-Google-Attributes: gid103376,public X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news2.google.com!postnews.google.com!s13g2000cwa.googlegroups.com!not-for-mail From: "Matthew Goulet" Newsgroups: comp.lang.ada Subject: Re: Conditional compilation of debug traces without cpp Followup-To: comp.lang.ada Date: 6 Jul 2006 22:00:47 -0700 Organization: http://groups.google.com Message-ID: <1152248447.796179.305520@s13g2000cwa.googlegroups.com> References: <44aaae35$0$5389$626a54ce@news.free.fr> <44ac1562$0$10269$636a55ce@news.free.fr> <4ufi8e.ig7.ln@hunter.axlog.fr> <44ad719c$0$5389$626a54ce@news.free.fr> NNTP-Posting-Host: 68.68.130.195 Mime-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" X-Trace: posting.google.com 1152248453 28161 127.0.0.1 (7 Jul 2006 05:00:53 GMT) X-Complaints-To: groups-abuse@google.com NNTP-Posting-Date: Fri, 7 Jul 2006 05:00:53 +0000 (UTC) User-Agent: G2/0.2 X-HTTP-UserAgent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.8.0.4) Gecko/20060406 Firefox/0.8 Firefox/1.5.0.4 (Debian-1.5.dfsg+1.5.0.4-1),gzip(gfe),gzip(gfe) Complaints-To: groups-abuse@google.com Injection-Info: s13g2000cwa.googlegroups.com; posting-host=68.68.130.195; posting-account=yLlJ6Q0AAACjX4d1DKwMmG8rfRSfe2So Xref: g2news2.google.com comp.lang.ada:5546 Date: 2006-07-06T22:00:47-07:00 List-Id: guillaume.portail@grospied.enanglais.com wrote: > Jean-Pierre Rosen wrote: > > > Therefore yes, the *execution* of the call will always involve the > > *evaluation* of the parameters (unless the compiler can prove that this > > evaluation has no side-effects - like a call to a function declared in a > > pure package). > > Ah yes, I just read LRM95-10.2.1(18), it seems to be what I want (I > forgot this point). But Pure is applicable only to library units. And I > need to apply it to functions of packages : > > package Data is > type T is private > procedure ... > private > type T is ... > end; > > package Data.Image > subtype T_String is String(...); > function "+" (R : T) return T_String; > ... > end; > > > - Data.Image."+" has really no side effect, but it cannot be declared > Pure. Why ? The legality of such a pragma seems statically computable > (the body of "+" should not access 'global' variables, etc). > - "+" is located in its own package, where UI resources are grouped, as > to facilitate their potential elimination/counting (all are named > *.*...*.Image). Perhaps I misunderstand what you are saying, but declaring the packages Pure means that the functions and procedures in them are also Pure. So, if Data and Data.Image were Pure, so should "+", even though pragma Pure cannot be applied to "+" directly. There is also the new pragma Pure_Function, but I cannot recall off the top of my head if it can be used outside of the context of a pure package. -Matt