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=ham autolearn_force=no version=3.4.4 X-Google-Thread: 103376,344faf475a6f812a X-Google-NewGroupId: yes X-Google-Attributes: gida07f3367d7,domainid0,public,usenet X-Google-Language: ENGLISH,ASCII-7-bit X-Received: by 10.180.106.73 with SMTP id gs9mr19072209wib.2.1366735926091; Tue, 23 Apr 2013 09:52:06 -0700 (PDT) Path: hg5ni17501wib.1!nntp.google.com!feeder1.cambriumusenet.nl!feed.tweaknews.nl!195.62.100.242.MISMATCH!newsfeed.kamp.net!newsfeed.kamp.net!eternal-september.org!feeder.eternal-september.org!mx05.eternal-september.org!.POSTED!not-for-mail From: Simon Wright Newsgroups: comp.lang.ada Subject: Re: Interresting difference in Normal-Returns/Expression-Functions and Extended-Returns. Date: Tue, 23 Apr 2013 17:52:04 +0100 Organization: A noiseless patient Spider Message-ID: References: <97967083-d21d-4de2-aeb8-76d0d5818993@googlegroups.com> Mime-Version: 1.0 Injection-Info: mx05.eternal-september.org; posting-host="759faf2487b2ffad9ca6f5463a606de4"; logging-data="24040"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19XkqghW7AbkZDjeZZz0xraA7al/6WwFos=" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.2 (darwin) Cancel-Lock: sha1:0a6SXD2ErJtn0yVPxhARAkWiZoM= sha1:Ejc9aiIT54LXRM5dNkeYj7XGaBw= Content-Type: text/plain Date: 2013-04-23T17:52:04+01:00 List-Id: Adam Beneschan writes: > The upshot of all this is that, by 7.6.1(4) and 9.3(2), in Make_ER, > the task created by the allocator *depends* *on* the body of Make_ER, > and therefore the body of Make_ER cannot complete until the task has > completed. That should be enough to explain the results. Yes, but there are other similar side effects: in the tests, OP wrote declare function Make(Input : in String) return not null access Testing renames Make_EF; P : constant array (Positive range <>) of not null access constant Testing:= ( Make("Bob"), Make("Steve"), Make("Dave"), Make("Joey") ); begin null; end TEST_1; and the code doesn't exit the declare block until all the tasks have completed. With the original code (modified as in my previous post) the output is TEST_1: Expression Function Bob starting. Steve starting. Dave starting. Joey starting. Joey 0.163312241 Dave 0.177723214 Steve 0.354075342 Bob 0.573863626 TEST_2: Normal Return Function Bob starting. Steve starting. Dave starting. Joey starting. Dave 0.302558333 Steve 0.427543312 Bob 0.457369596 Joey 0.469346672 TEST_3: Extended Return Function Bob starting. whereas changing 'not null access Testing' to a named access type 'Testing_P' gives TEST_1: Expression Function Bob starting. Steve starting. Dave starting. Joey starting. TEST_2: Normal Return Function Bob starting. Steve starting. Dave starting. Joey starting. TEST_3: Extended Return Function Bob starting. Steve starting. Dave starting. Joey starting. Terminating. Joey 0.030557213 Bob 0.052638587 Steve 0.076554827 Bob 0.104827218 Bob 0.122844748 Dave 0.315774351 Dave 0.446240813 Joey 0.512601733 Joey 0.560874224 Steve 0.698063731 Dave 0.702636242 Steve 0.852463245 By the way, what's the significance of 'constant' in 'not null access constant Testing'? > The moral: Whether or not you think anonymous access types are evil, > anonymous access types to *tasks* definitely can have some surprising > consequences (because of the task termination and dependency rules), > and should be avoided. This.