comp.lang.ada
 help / color / mirror / Atom feed
From: Dmitry A. Kazakov <mailbox@dmitry-kazakov.de>
Subject: Re: MI ammunition : linked lists
Date: Fri, 07 Nov 2003 11:39:29 +0100
Date: 2003-11-07T11:39:29+01:00	[thread overview]
Message-ID: <j2tmqvomt2h6g866irnjv2986n5mqn7jfr@4ax.com> (raw)
In-Reply-To: x7v1xslus3k.fsf@smaug.pushface.org

On 06 Nov 2003 21:03:59 +0000, Simon Wright <simon@pushface.org>
wrote:

>"Jean-Pierre Rosen" <rosen@adalog.fr> writes:
>
>> "amado.alves" <amado.alves@netcabo.pt> a �crit dans le message de news:mailman.293.1068136383.25614.comp.lang.ada@ada-france.org...
>> >A very common programming task where multiple inheritance (MI) would be
>> >handy: implementation of doubly linked lists.
>> [snip]
>> 
>> >  type Middle_Node is new First_Node with Last_Node;
>> I would take this as a typical example of abuse of MI.  Inheritance
>> should reflect an "is a" relationship. Do you fill comfortable
>> stating that a middle node is a first node and a last node at the
>> same time?
>
>I think the names are wrong: Followed_Node and Preceded_Node might be
>better. In which case a Middle_Node would indeed be both.
>
>I think the problem occurs when adding at the front or back of the
>list -- what was a Preceded_Node (at the end) now has to be replaced
>by a Middle_Node, which means that the next-to-last node has to have
>its Followed_By pointer changed to access the new next-to-last node
>.. grim .. similar problems on deletion .. really not worth the
>aggravation!

The nodes have to mutate. This is a semantical problem, and by no
means one of MI. See my response to the original post. The problem is
that if we distinguish nodes in any way, no matter how this difference
is exposed, we have to mutate a root node into a middle node an back.
This has nothing to do with whether middle nodes are descendants of
root nodes or not.

BTW in an Ada implementation of graphs, I did, the nodes were still
mutating, being SI.

---
Regards,
Dmitry Kazakov
www.dmitry-kazakov.de



  reply	other threads:[~2003-11-07 10:39 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-11-06 16:32 MI ammunition : linked lists amado.alves
2003-11-06 16:46 ` Stephen Leake
2003-11-06 17:15 ` Frank J. Lhota
2003-11-08 10:27   ` Dmitry A. Kazakov
2003-11-06 17:16 ` Jean-Pierre Rosen
2003-11-06 18:15   ` Wes Groleau
2003-11-06 21:03   ` Simon Wright
2003-11-07 10:39     ` Dmitry A. Kazakov [this message]
2003-11-07 10:29 ` Dmitry A. Kazakov
2003-11-10 14:51 ` Lutz Donnerhacke
2003-11-10 17:52   ` Marius Amado Alves
2003-11-11  9:32     ` Lutz Donnerhacke
2003-11-11 12:24       ` Marius Amado Alves
2003-11-11 12:58         ` Lutz Donnerhacke
2003-11-11 16:09           ` Robert I. Eachus
2003-11-11 17:11             ` Marius Amado Alves
2003-11-12  9:21               ` Lutz Donnerhacke
  -- strict thread matches above, loose matches on Subject: below --
2003-11-06 17:26 amado.alves
2003-11-06 17:33 amado.alves
2003-11-06 19:01 amado.alves
2003-11-11 18:38 ` Georg Bauhaus
2003-11-11 21:27   ` Marius Amado Alves
2003-11-12  0:23     ` Georg Bauhaus
2003-11-12 11:29 amado.alves
replies disabled

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