comp.lang.ada
 help / color / mirror / Atom feed
From: "Randy Brukardt" <randy@rrsoftware.com>
Subject: Re: Interresting difference in Normal-Returns/Expression-Functions and Extended-Returns.
Date: Wed, 1 May 2013 21:38:29 -0500
Date: 2013-05-01T21:38:29-05:00	[thread overview]
Message-ID: <klsjjd$qvv$1@munin.nbi.dk> (raw)
In-Reply-To: 03e84773-d616-4a46-8189-93ae4ab5fcbf@googlegroups.com

On Tuesday, April 23, 2013 9:52:04 AM UTC-7, Simon Wright wrote:
>
> > 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.

Adam says:
> I don't see a language reason for that.

I don't understand. The anonymous access type is declared in the block, as 
the master of an access return is that of the point of call [it's passed 
into the function if necessary]. (That's changed in Ada 2012, but the 
previous definition was nonsense.) That's the master of the allocators. So 
of course the tasks "belong" to the master of the block, and the block has 
to wait for them to complete.

BTW, I don't think the extended return should be different, but I have no 
interest in figuring out whether it could or not. It probably depends on 
exactly how/where the allocator is written.

No human can figure these things out, so please don't use them and save the 
brain of an ARG member. ;-)

                                  Randy.


  parent reply	other threads:[~2013-05-02  2:38 UTC|newest]

Thread overview: 33+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-04-22 18:27 Interresting difference in Normal-Returns/Expression-Functions and Extended-Returns Shark8
2013-04-22 19:13 ` Dmitry A. Kazakov
2013-04-22 20:11   ` Shark8
2013-04-23  6:15     ` Simon Wright
2013-04-23  7:35     ` Stephen Leake
2013-04-23  8:58     ` Dmitry A. Kazakov
2013-05-02  2:20     ` Randy Brukardt
2013-05-02  4:41       ` Shark8
2013-04-23  6:32 ` egilhh
2013-04-23 15:24   ` Adam Beneschan
2013-04-24  5:56     ` egilhh
2013-04-24 14:40       ` Adam Beneschan
2013-04-25  5:30         ` egilhh
2013-04-25  5:41           ` Shark8
2013-04-23 16:00 ` Adam Beneschan
2013-04-23 16:52   ` Simon Wright
2013-04-23 17:57     ` Adam Beneschan
2013-04-25  8:48       ` egilhh
2013-04-25 15:19         ` Adam Beneschan
2013-05-02  2:33         ` Randy Brukardt
2013-05-02  2:38       ` Randy Brukardt [this message]
2013-05-02 16:15         ` Adam Beneschan
2013-05-02 22:00           ` Randy Brukardt
2013-05-03  1:11         ` Adam Beneschan
2013-05-03  5:34           ` Simon Wright
2013-05-03  6:43           ` egilhh
2013-05-03 16:49             ` Adam Beneschan
2013-05-03 23:09           ` Randy Brukardt
2013-04-23 23:00     ` Shark8
2013-04-23 23:16       ` Adam Beneschan
2013-05-02  2:28   ` Randy Brukardt
2013-05-02 16:37     ` Adam Beneschan
2013-04-23 16:33 ` Simon Wright
replies disabled

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