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.3 required=5.0 tests=BAYES_00,INVALID_MSGID autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,f0ba82308a594485 X-Google-Attributes: gid103376,public From: lutz@iks-jena.de (Lutz Donnerhacke) Subject: Re: Right of Optimize Eager Evaluation Away Date: 1999/11/29 Message-ID: #1/1 X-Deja-AN: 554565376 Distribution: world Content-Transfer-Encoding: 8bit References: <863dtqfo26.fsf@ppp-173-146.villette.club-internet.fr> <861z9afhgd.fsf@ppp-173-146.villette.club-internet.fr> <38420578.D6692D2E@callnetuk.com> <86iu2lvyed.fsf@ppp-105-76.villette.club-internet.fr> Content-Type: text/plain; charset=ISO-8859-1 Organization: IKS GmbH Jena Mime-Version: 1.0 User-Agent: slrn/0.9.5.7 (UNIX) Newsgroups: comp.lang.ada Date: 1999-11-29T00:00:00+00:00 List-Id: * 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.