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-06 13:06:16 PST Path: archiver1.google.com!news2.google.com!news.maxwell.syr.edu!kibo.news.demon.net!news.demon.co.uk!demon!not-for-mail From: Simon Wright Newsgroups: comp.lang.ada Subject: Re: MI ammunition : linked lists Date: 06 Nov 2003 21:03:59 +0000 Organization: Pushface Sender: simon@smaug.pushface.org Message-ID: References: NNTP-Posting-Host: pogner.demon.co.uk Mime-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: 8bit X-Trace: news.demon.co.uk 1068152773 7440 62.49.19.209 (6 Nov 2003 21:06:13 GMT) X-Complaints-To: abuse@demon.net NNTP-Posting-Date: Thu, 6 Nov 2003 21:06:13 +0000 (UTC) User-Agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.1 Xref: archiver1.google.com comp.lang.ada:2170 Date: 2003-11-06T21:03:59+00:00 List-Id: "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! > My advice would be: use MI (and SI as well) IF AND ONLY IF it makes > things simpler. Don't bother if people tell you that you are not > "purely object oriented" ;-) Yes! -- Simon Wright 100% Ada, no bugs.