comp.lang.ada
 help / color / mirror / Atom feed
From: "Dmitry A. Kazakov" <mailbox@dmitry-kazakov.de>
Subject: Re: Ada 2005 puzzle
Date: Sun, 22 Jul 2012 10:03:29 +0200
Date: 2012-07-22T10:03:29+02:00	[thread overview]
Message-ID: <nv0xyn9z4ymo$.1932p79z1zpqz$.dlg@40tude.net> (raw)
In-Reply-To: 2a1f6145-2aa1-4af3-aca0-2fc0b3a78efe@googlegroups.com

On Sat, 21 Jul 2012 15:46:47 -0700 (PDT), Maciej Sobczak wrote:

> W dniu pi�tek, 20 lipca 2012 14:49:14 UTC+2 u�ytkownik Dmitry A. Kazakov napisa�:
> 
>> I meant here a different thing. If you have some dispatching operations to 
>> be performed upon initialization,
> 
> I'm not sure what possible use-case would motivate it - I don't see any in
> the container's interface. Containers are not supposed to be more smart
> than necessary, they just have to keep objects.

But they cannot be more stupid than objects they keep. The use case is a
container of T'Class. T is abstract. Upon its initialization, which is
non-abstract, the initialization calls to an abstract operation Foo:

procedure Initialize (X : in out T) is
begin
   ...
   Foo (T'Class (X));
end Initialize;
 
>> Let you have a hierarchy of types  T1:&gt;T2:&gt;T3. Then construction should run 
>> as follows:
>> 
>> stage 1
>> T1 constraints evaluation
>> T2 constraints
>> T3 constraints
>> 
>> allocation
>> 
>> stage 2
>> T1 initialization
>> T2 initialization
>> T3 initialization
>> 
>> stage 3
>> T1'Class initialization, only here we could dispatch on T1'Class
>> T2'Class initialization
>> T3'Class initialization
>> 
>> 1-3 cannot be effectively fused into single operation
> 
> Stage 3 is implicit, so we don't have to care,

Actually we have to, not only because people want to dispatch upon
initialization. The same problem arise with Rosen's trick. Most typically
when a component of T1 is a task carrying T1'Class as an access
discriminant. When you wanted a rendezvous with the task upon
initialization, you get a nice deadlock (or Tasking_Error). Component tasks
are created during 2. They start no earlier than during 3.

-- 
Regards,
Dmitry A. Kazakov
http://www.dmitry-kazakov.de



  reply	other threads:[~2012-07-26 14:35 UTC|newest]

Thread overview: 46+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-07-12 12:54 Ada 2005 puzzle Dmitry A. Kazakov
2012-07-12 15:48 ` Adam Beneschan
2012-07-12 16:34   ` Dmitry A. Kazakov
2012-07-19  6:53     ` Randy Brukardt
2012-07-19  7:55       ` Dmitry A. Kazakov
2012-07-20  2:22         ` Randy Brukardt
2012-07-20  7:20           ` Dmitry A. Kazakov
2012-07-21  0:04             ` Randy Brukardt
2012-07-21  8:34               ` Dmitry A. Kazakov
2012-07-24  2:38                 ` Randy Brukardt
2012-07-24  4:23                   ` Adam Beneschan
2012-07-24  7:54                     ` Dmitry A. Kazakov
2012-07-25 23:39                       ` Randy Brukardt
2012-07-26  7:41                         ` Dmitry A. Kazakov
2012-07-26 13:08                           ` Simon Wright
2012-07-26 13:55                             ` Dmitry A. Kazakov
2012-07-27  9:42                               ` AdaMagica
2012-07-27 10:32                                 ` Dmitry A. Kazakov
2012-07-27 11:58                                   ` Georg Bauhaus
2012-07-27 13:04                                     ` Dmitry A. Kazakov
2012-07-28  9:48                                       ` AdaMagica
2012-07-28 10:37                                         ` Dmitry A. Kazakov
2012-07-28 16:59                                           ` AdaMagica
2012-07-28 18:21                                             ` Dmitry A. Kazakov
2012-07-19  8:04       ` Maciej Sobczak
     [not found]         ` <juaghb$fv9$1@munin.nbi.dk>
2012-07-20  7:30           ` Dmitry A. Kazakov
2012-07-21 17:21             ` Vasiliy Molostov
2012-07-21 19:03               ` Dmitry A. Kazakov
2012-07-21 19:37                 ` Vasiliy Molostov
2012-07-21 20:23                   ` Dmitry A. Kazakov
2012-07-21 20:53                     ` Vasiliy Molostov
2012-07-22  7:41                       ` Dmitry A. Kazakov
2012-07-22  8:00                         ` Vasiliy Molostov
2012-07-22  8:19                           ` Dmitry A. Kazakov
2012-07-22  9:06                             ` Vasiliy Molostov
2012-07-22  9:34                               ` Dmitry A. Kazakov
2012-07-20  8:09           ` Maciej Sobczak
2012-07-20  8:27             ` Dmitry A. Kazakov
2012-07-20 11:30               ` Maciej Sobczak
2012-07-20 12:49                 ` Dmitry A. Kazakov
2012-07-21 22:46                   ` Maciej Sobczak
2012-07-22  8:03                     ` Dmitry A. Kazakov [this message]
2012-07-22 10:08               ` Florian Weimer
2012-07-22 11:18                 ` Dmitry A. Kazakov
2012-07-21  0:12             ` Randy Brukardt
2012-07-22  9:52       ` Florian Weimer
replies disabled

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