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!reader02.eternal-september.org!.POSTED!not-for-mail From: Simon Wright Newsgroups: comp.lang.ada Subject: Re: time of update of new values for out mode parameters Date: Tue, 20 Mar 2018 05:54:46 +0000 Organization: A noiseless patient Spider Message-ID: References: <4598be4c-7a4b-4bdd-8fd3-99b943e77823@googlegroups.com> <13e52a81-4991-4361-9e1b-c9673faebaec@googlegroups.com> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: reader02.eternal-september.org; posting-host="11c1197a3eb66d01c7ebcb598b417c4b"; logging-data="26185"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/Ep9VsCTO7Y2NWw/3TBvtCyK2LtdVU9A4=" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.3 (darwin) Cancel-Lock: sha1:MpaWK9q9CrqgDgYUNp/j22LeNpQ= sha1:OQxTEmCxASQQ66RUnLD7yXvJE+k= Xref: reader02.eternal-september.org comp.lang.ada:51082 Date: 2018-03-20T05:54:46+00:00 List-Id: Mehdi Saada <00120260a@gmail.com> writes: > Ok. To be honest, the use case I had in mind was a wrong one, is meant > to be implemented through protected types. > > let's say: > procedure FOO (A: out A_TYPE) is > ... A := something; -- Can't know when it's copied back > procedure FOO2 (a: access A_TYPE) is > ... A.all := something; -- Can't know for sure either, right ? All you can say is that it will have been copied out by the time you've returned from the calls. But that must be enough; if there were two threads making the different calls, how would you be able to tell which made the earlier call? > but I am sure with > until some_absolute_time; some_protected_object.Write(something); > , and another task can use it safely. > Now, about procedure FOO (A: out A_TYPE) is > ... delay until some_absolute_time; > A := something; delay until the_other_hour; You are seriously overthinking this. > I shall assume that inside FOO, A = something" (obviously), but shall > not assume this for the world outside FOO ? At the level of Ada code, you have to assume this. How could you possibly write any sort of reliable program if it were otherwise>?