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-7-bit X-Google-Thread: 103376,34c2aa33b8bdb1a9 X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2002-01-17 06:55:18 PST Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!logbridge.uoregon.edu!news-FFM2.ecrc.net!news.iks-jena.de!lutz From: lutz@iks-jena.de (Lutz Donnerhacke) Newsgroups: comp.lang.ada Subject: Re: Sugestion to Multiple Inheritance Date: Thu, 17 Jan 2002 14:54:51 +0000 (UTC) Organization: IKS GmbH Jena Message-ID: References: NNTP-Posting-Host: taranis.iks-jena.de X-Trace: branwen.iks-jena.de 1011279291 11019 217.17.192.37 (17 Jan 2002 14:54:51 GMT) X-Complaints-To: usenet@iks-jena.de NNTP-Posting-Date: Thu, 17 Jan 2002 14:54:51 +0000 (UTC) User-Agent: slrn/0.9.6.3 (Linux) Xref: archiver1.google.com comp.lang.ada:19014 Date: 2002-01-17T14:54:51+00:00 List-Id: * Stephen Leake wrote: >lutz@iks-jena.de (Lutz Donnerhacke) writes: >> >> They do not need to be types at all. They are abstactions => interfaces. >> >> Example: A describes a sort algorithm. B describes stableness. C describes >> >> in-place-ness. D describes stable, in-place sort algorithms. >> > >> >Well, if they don't have to be types, you can easily do it in Ada. But >> >all your complaints were that it could not be done with abstract Ada >> >types. >> >> I'm sorry for providing my solutions in the same posting asking for hints. >> How can this be done easily? > >Just write packages A, B, C, D, with appropriate subprogram >declarations in the spec, and appropriate comments saying what they >do. Then in the body of D, call the subprograms in B and C as >appropriate. > >The Ada code will _not_ describe the inheritance structure, except in >the comments. Perhaps that is why you don't want to do this. Let's try to code this: package Sorts is function Sort (col : Collection) return Collection is abstract; procedure Sort (col : in out Collection) is abstract; end package Sorts; with Sorts; package Stable_Sorts is function Sort renames Sorts.Sort; end package Stable_Sorts; with Sorts; package Inplace_Sorts is procedure Sort renames Sorts.Sort; end package Stable_Sorts; with Stable_Sorts, Inplace_Sorts; package Stable_Inplace_Sorts is procedure Sort renames ?; end package;