comp.lang.ada
 help / color / mirror / Atom feed
From: "Matthew Goulet" <blueherring0@gmail.com>
Subject: Re: Conditional compilation of debug traces without cpp
Date: 6 Jul 2006 22:00:47 -0700
Date: 2006-07-06T22:00:47-07:00	[thread overview]
Message-ID: <1152248447.796179.305520@s13g2000cwa.googlegroups.com> (raw)
In-Reply-To: 44ad719c$0$5389$626a54ce@news.free.fr

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




  reply	other threads:[~2006-07-07  5:00 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-07-04 18:06 Conditional compilation of debug traces without cpp guillaume.portail
2006-07-04 19:07 ` Ludovic Brenta
2006-07-04 19:14   ` guillaume.portail
2006-07-04 21:39     ` Björn Persson
2006-07-04 21:43       ` guillaume.portail
2006-07-04 22:01         ` Björn Persson
2006-07-05  3:10     ` Matthew Goulet
2006-07-04 20:24 ` Gautier
2006-07-04 20:54 ` Simon Wright
2006-07-05 13:03 ` Jean-Pierre Rosen
2006-07-05 19:39   ` guillaume.portail
2006-07-06  5:53     ` Martin Krischik
2006-07-07 10:32       ` Stephen Leake
2006-07-07 14:08         ` M E Leypold
2006-07-06  7:59     ` Jean-Pierre Rosen
2006-07-06 20:25       ` guillaume.portail
2006-07-07  5:00         ` Matthew Goulet [this message]
2006-07-07 13:57           ` Thierry Bernier
2006-07-07 21:08           ` Randy Brukardt
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox