comp.lang.ada
 help / color / mirror / Atom feed
From: lutz@iks-jena.de (Lutz Donnerhacke)
Subject: Re: Right of Optimize Eager Evaluation Away
Date: 1999/11/29
Date: 1999-11-29T00:00:00+00:00	[thread overview]
Message-ID: <slrn845pht.18l.lutz@taranis.iks-jena.de> (raw)
In-Reply-To: 86iu2lvyed.fsf@ppp-105-76.villette.club-internet.fr

* Laurent Guerby wrote:
>It looks like to me that the Ada language more or less intend that
>functions shouldn't have side effects, since by example it allows the
>compiler to evaluate arguments and thus potentially calling functions
>in any order, or allows only "in" parameters for the programmer.
>
>The question is then, why stop at allowing any evaluation order and
>not just allow lazy evaluation as well?

You may provide a pragma to tell the compiler that this function is really a
pure functional function. Then it is allowed to optimize this way.

>The "pragma" I was mentionning could look like:
>pragma You_Can_Omit_Calls_To_This_If_The_Value_Is_Not_Needed (F);
>
>(obviously a better name is needed ;-). If an expression involves only

pragma Pure_Function ([Entity =>] function_LOCAL_NAME);
...

     Note: All functions in a Pure' package are automatically pure, and
     there is no need to use pragma Pure_Function' in this case.

     Note: If pragma Pure_Function' is applied to a renamed function,
     it applies to the underlying renamed function. This can be used to
     disambiguate cases of overloading where some but not all functions
     in a set of overloaded functions are to be designated as pure.
     




  parent reply	other threads:[~1999-11-29  0:00 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1999-11-28  0:00 Right of Optimize Eager Evaluation Away Laurent Guerby
1999-11-28  0:00 ` Robert A Duff
1999-11-28  0:00   ` Laurent Guerby
1999-11-29  0:00     ` Nick Roberts
1999-11-29  0:00       ` Robert A Duff
1999-11-29  0:00         ` Laurent Guerby
1999-11-29  0:00           ` Niklas Holsti
1999-11-29  0:00           ` Robert A Duff
1999-11-30  0:00             ` Laurent Guerby
1999-11-29  0:00           ` Lutz Donnerhacke [this message]
1999-11-29  0:00 ` Jean-Pierre Rosen
replies disabled

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