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=unavailable autolearn_force=no version=3.4.4 Path: eternal-september.org!reader01.eternal-september.org!.POSTED!not-for-mail From: Simon Wright Newsgroups: comp.lang.ada Subject: Re: ? Is ok return a type derived from ada.finalization.controlled from a "Pure_Function" ? thanks. Date: Sat, 26 Jan 2019 11:48:46 +0000 Organization: A noiseless patient Spider Message-ID: References: Mime-Version: 1.0 Content-Type: text/plain Injection-Info: reader02.eternal-september.org; posting-host="d537c2f82a35372c8fdbdd2a1555bfe3"; logging-data="3284"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/p++BmkH5mHBoFYNiW//J5ih0T5Xvha6g=" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.1 (darwin) Cancel-Lock: sha1:IZrS4rcr4MXy0cGYsfo6ogzArYI= sha1:B49k7MvAUropv+EusDV83YeyI54= Xref: reader01.eternal-september.org comp.lang.ada:55380 Date: 2019-01-26T11:48:46+00:00 List-Id: danielcheagle@gmail.com writes: > Is ok return a type derived from ada.finalization.controlled > from a function declared "Pure_Function" ? > > Or yet, is ok declare a fuction returning a > controlled type as "pure_function" ? Given that the documentation of Pure_Function[1] says ... the compiler can assume that there are no side effects, and in particular that two calls with identical arguments produce the same result and that ... there are no static checks to try to ensure that this promise is met it would be a Bad Idea to apply it to your function. [1] https://gcc.gnu.org/onlinedocs/gnat_rm/Pragma-Pure_005fFunction.html