From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00 autolearn=ham autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII X-Google-Thread: 103376,ecfc0548c2df0d76 X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2003-11-07 02:37:26 PST Path: archiver1.google.com!news2.google.com!fu-berlin.de!uni-berlin.de!tar-alcarin.cbb-automation.DE!not-for-mail From: Dmitry A. Kazakov Newsgroups: comp.lang.ada Subject: Re: MI ammunition : linked lists Date: Fri, 07 Nov 2003 11:39:29 +0100 Message-ID: References: NNTP-Posting-Host: tar-alcarin.cbb-automation.de (212.79.194.111) Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8bit X-Trace: news.uni-berlin.de 1068201445 47792046 212.79.194.111 (16 [77047]) X-Newsreader: Forte Agent 1.8/32.548 Xref: archiver1.google.com comp.lang.ada:2195 Date: 2003-11-07T11:39:29+01:00 List-Id: On 06 Nov 2003 21:03:59 +0000, Simon Wright wrote: >"Jean-Pierre Rosen" writes: > >> "amado.alves" 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