comp.lang.ada
 help / color / mirror / Atom feed
From: "Dmitry A. Kazakov" <mailbox@dmitry-kazakov.de>
Subject: Re: Getting the index for an element in mutually referencing containers
Date: Sat, 11 Mar 2017 21:52:05 +0100
Date: 2017-03-11T21:52:05+01:00	[thread overview]
Message-ID: <oa1o1j$1tuh$1@gioia.aioe.org> (raw)
In-Reply-To: lytw6zbmve.fsf@pushface.org

On 2017-03-11 21:05, Simon Wright wrote:
> "Dmitry A. Kazakov" <mailbox@dmitry-kazakov.de> writes:
>
>> On 2017-03-11 12:21, Simon Wright wrote:
>>> "Dmitry A. Kazakov" <mailbox@dmitry-kazakov.de> writes:
>>>
>>>> This looks like a clear case for reference counted objects. A handle
>>>> to Person to be put into containers (for search) and into other
>>>> objects for referencing. No problem with limited types. Weak handles
>>>> are for backward referencing and so on.
>>>
>>> Does that mean reference-counted _handles_?
>>
>> Objects are reference-counted. Handles are not.
>>
>>> If you have multiple handles
>>> to a particular Person object, which gets deleted, you'd want all those
>>> handles to be invalidated.
>>
>> It is in essence the difference between weak and strong references. If
>> you want a reference invalidated when the object vanishes that would
>> be a weak reference. In order to access object through weak reference
>> you first elevate it to a strong one. You drop the strong reference
>> once you used the object.
>>
>> The semantics of "object deleted" is in question. Usually it is merely
>> throwing it out of some list (container) and thus decreasing object's
>> reference count. The object stays alive until nobody else uses it =
>> nobody holds a strong reference to it.
>
> That seems to be a very computer-oriented viewpoint. If your objects
> represent real-world objects (or roles, or events - OOA view) then you
> wouldn't want them to hang around! If you decide to abort an engagement
> and therefore delete the Missile object, whose finalization sends a
> self-destruct command to the corresponding missile in flight, you want
> it to happen Right Now.

If you have control over it. In the real world, which includes real 
programs, you might have none and there is no such thing as "now" anyway.

Then I would say that rather your idea is computer-oriented. Objects are 
given us in their public operations. Once you cannot apply any to the 
object, or in other semantics, if Object.Exists yields False, there is 
no object. In terms of missiles, when you see a cloud of explosion, the 
work is done. You drop the last your reference and don't care if the 
object transited into another dimension or some object paradise. If you 
don't see it by any programmatic means, then there is none.

P.S. The idea that the world consists of objects is the symbol of faith 
of the Church of Object-Orientation...

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

  reply	other threads:[~2017-03-11 20:52 UTC|newest]

Thread overview: 33+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-03-09 13:45 Getting the index for an element in mutually referencing containers Mart van de Wege
2017-03-09 15:25 ` Egil H H
2017-03-09 15:45   ` Mart van de Wege
2017-03-09 16:02     ` Mart van de Wege
2017-03-09 16:11     ` Egil H H
     [not found] ` <ly7f3xedp4.fsf@pushface.org>
     [not found]   ` <86k27xpikd.fsf@gaheris.avalon.lan>
     [not found]     ` <lywpbxc9my.fsf@pushface.org>
     [not found]       ` <86wpbxneuz.fsf@gaheris.avalon.lan>
     [not found]         ` <o9vcbp$t0t$1@franka.jacob-sparre.dk>
2017-03-11  6:45           ` Mart van de Wege
2017-03-11  8:40           ` Simon Wright
2017-03-11  8:58             ` Dmitry A. Kazakov
2017-03-11 11:21               ` Simon Wright
2017-03-11 14:18                 ` Dmitry A. Kazakov
2017-03-11 20:05                   ` Simon Wright
2017-03-11 20:52                     ` Dmitry A. Kazakov [this message]
2017-03-11 21:46                       ` Simon Wright
2017-03-11 22:37                         ` Niklas Holsti
2017-03-12  8:22                           ` Simon Wright
2017-03-12  9:38                             ` G.B.
2017-03-12 11:21                               ` Simon Wright
2017-03-13 10:29                             ` Alejandro R. Mosteo
2017-03-12  8:20                         ` Dmitry A. Kazakov
2017-03-12 11:30                           ` Simon Wright
2017-03-12 11:55                             ` Dmitry A. Kazakov
2017-03-12 16:44                               ` Simon Wright
2017-03-12 17:42                                 ` Dmitry A. Kazakov
2017-03-13 19:55                                   ` Randy Brukardt
2017-03-13 20:53                                     ` Dmitry A. Kazakov
2017-03-14 20:40                                       ` Randy Brukardt
2017-03-15  8:44                                         ` Dmitry A. Kazakov
2017-03-15 20:12                                           ` Randy Brukardt
2017-03-16  2:59                                             ` Paul Rubin
2017-03-16  9:04                                             ` Dmitry A. Kazakov
2017-03-13 23:25                                   ` Simon Wright
2017-03-14  8:25                                     ` Dmitry A. Kazakov
2017-03-12  1:36             ` Randy Brukardt
replies disabled

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