comp.lang.ada
 help / color / mirror / Atom feed
From: "Dmitry A. Kazakov" <mailbox@dmitry-kazakov.de>
Subject: Re: Finalization of library level tasks
Date: Sat, 28 Apr 2018 10:35:31 +0200
Date: 2018-04-28T10:35:31+02:00	[thread overview]
Message-ID: <pc1bok$iqf$1@gioia.aioe.org> (raw)
In-Reply-To: pc03h3$e9d$1@franka.jacob-sparre.dk

On 2018-04-27 23:08, Randy Brukardt wrote:
> "Dmitry A. Kazakov" <mailbox@dmitry-kazakov.de> wrote in message
> news:pbuk07$9mf$1@gioia.aioe.org...
> ...
>> It is not reusable when the code depends on whether the object is declared
>> at the library level or not.
> 
> That only happens if you write broken code in the first place: tasks should
> never be embedded in objects.

You argued for reusable code and ended up with claiming encapsulation 
broken?

> It simply doesn't work (Ichbiah got that
> wrong). When you do so, termination is a problem, but so is avoiding
> deadlocks, race conditions, and the like.

These are imposed by the language not by the program logic.

> The entire nesting model of tasks
> in Ada is huge overkill and should never have happened - it's a huge amount
> of complexity for a value approaching zero. (Note that the first thing
> Ravenscar discards is the nesting model.)

while Ravescar itself is discarded by most applications.

>>>> There are dozens ways to fix the mess but there seems no interest at
>>>> all.
>>>
>>> Correction: there are dozens of ways to make a worse mess. There is no
>>> way
>>> to "fix" the issue, because any change to the rules just breaks in some
>>> other case. Or completely destroys the ability of ADTs to assume that
>>> finalization happens.
>>
>> Nothing will be broken by adding a Boolean attribute T'Completion_Awaited.
> 
> I've been told that would lead people to writing code which depends on race
> conditions. I'm not enough of an expert on tasking to try to disagree with
> people that are.

Better that code than no code at all. Presently no functional code can 
be written. In order to make an argument people who told you that must 
present a working code without alleged "race conditions". There is none, 
so the argument is void.

>> Nothing will be broken by fixing the finalization model that does not
>> distinguish finalization of the class from finalization of the
>> type-specific object.
> 
> A class is purely a static construct (just like privacy), while finalization
> is a purely dynamic construct. There's nothing to "distinguish" -- at
> runtime, all objects have a specific type.

Yes, but is irrelevant to the lifetime of the said objects. I am talking 
about objects [containing tasks].

> Finalization of a "class" can do
> nothing, as there is nothing dynamically to do with classes.

It is not finalization of the class of types, it is finalization of an 
instance of a class-wide object.

Each object of a tagged type is an instance of this type, and per 
language design that allows views, an instance of *all* ancestor types. 
Per same design, it is also an instance of all class-wide types rooted 
in the said types.

All these instances *must* be finalized: X of T1 <- T2 <- T3 must be 
finalized in the order

    Finalize (T1'Class (X));
    Finalize (T2'Class (X));
    Finalize (T3'Class (X));
    Finalize (T3 (X));  -- Only this is actually done
    Finalize (T2 (X));  -- These are left for the user
    Finalize (T1 (X));

> ...
>> Nothing will be broken by adding user-controlled aspect to access type to
>> kill any bookkeeping, any hidden lists, any dependencies.
> 
> Of course, the invariant that finalization always happens would be broken.
> That's a dead body issue with me, as it would destroy the ability to write
> reusable libraries.

No, it will only allow that. The same effect is customary achieved by 
declaring all access types at the library level. That makes the code 
more re-usable because it eliminates harmful checks. Pointers are too 
hot for any language to handle. Just leave them be and allow the 
programmer to do things right.

> Note that as with memory allocation, a well-designed reusable library needs
> to be agnostic as to how clients use it in tasks. It should work properly
> when used sequentially, with multiple tasks, with parallel blocks/loops, and
> anything yet to be invented. That means nothing active should be in the
> library anymore than that the library should be allocating any memory.

Just my point. If anybody knows how to make it working then the programmer.

> ...
>> I don't see how this will help with designing active objects, writing
>> servers for I/O protocols, handling pools of worker tasks.
> 
> IMHO, active objects are evil. Use something like Parafin for pools for
> worker tasks (or just a parallel loop with the task checking turned off).
> "terminate" works fine for most servers, that's what it was designed for.

Unless you need start and stop servers on demand.

> And both pools and servers are always going to be at library level, so the
> workarounds can be used if "terminate" doesn't work.

No, because servers are parts of the components that come and go. You 
are thinking about some sort of monolithic application which is a use 
case taking less and less percentage.

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


  reply	other threads:[~2018-04-28  8:35 UTC|newest]

Thread overview: 89+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-04-15 13:40 Finalization of library level tasks Dmitry A. Kazakov
2018-04-15 14:02 ` Jeffrey R. Carter
2018-04-15 14:12   ` Dmitry A. Kazakov
2018-04-15 14:54     ` Jeffrey R. Carter
2018-04-15 15:15       ` Dmitry A. Kazakov
2018-04-15 15:46         ` AdaMagica
2018-04-15 15:53           ` Dmitry A. Kazakov
2018-04-15 17:17           ` AdaMagica
2018-04-15 17:40             ` Dmitry A. Kazakov
2018-04-15 19:32               ` Egil H H
2018-04-15 20:09                 ` Dmitry A. Kazakov
2018-04-25 23:49                   ` Randy Brukardt
2018-04-16  5:19               ` J-P. Rosen
2018-04-16  7:30                 ` Dmitry A. Kazakov
2018-04-16  7:55                   ` J-P. Rosen
2018-04-16  8:13                     ` Dmitry A. Kazakov
2018-04-16  8:32                       ` J-P. Rosen
2018-04-16 15:26                         ` Dmitry A. Kazakov
2018-04-17  9:51                           ` AdaMagica
2018-04-17 12:31                             ` Dmitry A. Kazakov
2018-04-17 15:37                               ` Jeffrey R. Carter
2018-04-17 15:57                                 ` Dmitry A. Kazakov
2018-04-17 20:16                                   ` Jeffrey R. Carter
2018-04-17 20:59                                     ` Dmitry A. Kazakov
2018-04-18  5:20                                       ` J-P. Rosen
2018-04-17 20:55                                   ` J-P. Rosen
2018-04-17 21:23                                     ` Dmitry A. Kazakov
2018-04-18  5:26                                       ` J-P. Rosen
2018-04-26  0:02                                         ` Randy Brukardt
2018-04-18  8:06                               ` AdaMagica
2018-04-18  8:25                                 ` Dmitry A. Kazakov
2018-04-18  8:52                                   ` Egil H H
2018-04-18  9:58                                     ` Dmitry A. Kazakov
2018-04-18 11:33                                       ` J-P. Rosen
2018-04-18 11:58                                         ` Dmitry A. Kazakov
2018-04-18 12:00                                           ` J-P. Rosen
2018-04-18 12:25                                             ` Dmitry A. Kazakov
2018-04-18 13:51                                               ` J-P. Rosen
2018-04-18 14:12                                                 ` Dmitry A. Kazakov
2018-04-18 14:52                                                   ` J-P. Rosen
2018-04-18 15:04                                                     ` Dmitry A. Kazakov
2018-04-18 20:26                                                       ` AdaMagica
2018-04-18 21:00                                                         ` Dmitry A. Kazakov
2018-04-18 20:40                                                     ` AdaMagica
2018-04-19  7:34                                                       ` Simon Wright
2018-04-18 21:29                                                     ` J-P. Rosen
2018-04-19  7:32                                                       ` Dmitry A. Kazakov
2018-04-26  0:04                                       ` Randy Brukardt
2018-04-26  8:56                                         ` Dmitry A. Kazakov
2018-04-26 22:10                                           ` Randy Brukardt
2018-04-27  4:48                                             ` J-P. Rosen
2018-04-27 20:52                                               ` Randy Brukardt
2018-04-17 11:16                           ` J-P. Rosen
2018-04-17 12:47                             ` Dmitry A. Kazakov
2018-04-17 14:08                               ` J-P. Rosen
2018-04-17 14:47                                 ` Dmitry A. Kazakov
2018-04-17 22:00                                   ` Robert A Duff
2018-04-18  7:25                                     ` Dmitry A. Kazakov
2018-04-25 23:54                           ` Randy Brukardt
2018-04-26 16:22                             ` Jeffrey R. Carter
2018-04-26 16:43                               ` Dmitry A. Kazakov
2018-04-26 20:19                                 ` J-P. Rosen
2018-04-16  9:19               ` AdaMagica
2018-04-16 15:15                 ` Dmitry A. Kazakov
2018-04-19 20:39           ` G. B.
2018-04-20  7:27             ` Dmitry A. Kazakov
2018-04-25 23:46         ` Randy Brukardt
2018-04-26  9:03           ` Dmitry A. Kazakov
2018-04-26 22:25             ` Randy Brukardt
2018-04-27  7:37               ` Dmitry A. Kazakov
2018-04-27  8:32                 ` AdaMagica
2018-04-27  8:57                   ` Dmitry A. Kazakov
2018-04-27 21:08                 ` Randy Brukardt
2018-04-28  8:35                   ` Dmitry A. Kazakov [this message]
2018-04-29 17:41                     ` AdaMagica
2018-04-29 19:36                       ` Dmitry A. Kazakov
2018-04-30 12:27                         ` AdaMagica
2018-04-30 13:03                           ` Dmitry A. Kazakov
2018-04-30 16:52                           ` Jeffrey R. Carter
2018-04-30 17:06                             ` Dmitry A. Kazakov
2018-05-01  9:17                             ` AdaMagica
2018-05-01  9:40                               ` Dmitry A. Kazakov
2018-05-01 11:18                               ` Jeffrey R. Carter
2018-05-01 11:27                                 ` Dmitry A. Kazakov
2018-05-01 15:54                                 ` Niklas Holsti
2018-05-02 14:34                                   ` AdaMagica
2018-05-02 14:50                                     ` Dmitry A. Kazakov
2018-05-01  2:27                     ` Randy Brukardt
2018-05-01  6:59                       ` Dmitry A. Kazakov
replies disabled

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