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,4cd85c8656c704b6 X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2002-12-03 04:56:44 PST Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!logbridge.uoregon.edu!arclight.uoregon.edu!wn14feed!wn12feed!worldnet.att.net!207.217.77.102!newsfeed2.earthlink.net!newsfeed.earthlink.net!stamper.news.pas.earthlink.net!newsread2.prod.itd.earthlink.net.POSTED!not-for-mail Message-ID: <3DECAA3A.F3E7BA90@earthlink.net> From: "Marc A. Criley" Organization: Quadrus Corporation X-Mailer: Mozilla 4.73 [en] (X11; U; Linux 2.2.14-5.0 i686) X-Accept-Language: en MIME-Version: 1.0 Newsgroups: comp.lang.ada Subject: Re: Style question: deep inheritance References: <5463bc76.0212030344.712c30aa@posting.google.com> Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Date: Tue, 03 Dec 2002 12:56:43 GMT NNTP-Posting-Host: 63.190.208.49 X-Complaints-To: abuse@earthlink.net X-Trace: newsread2.prod.itd.earthlink.net 1038920203 63.190.208.49 (Tue, 03 Dec 2002 04:56:43 PST) NNTP-Posting-Date: Tue, 03 Dec 2002 04:56:43 PST Xref: archiver1.google.com comp.lang.ada:31377 Date: 2002-12-03T12:56:43+00:00 List-Id: David Kristola wrote: > > I am working on a MUD in Ada. Inheritance lends > itself well to the problem domain, but after a few > levels of child types in child packages, i am > facing some ridiculously long names. For > instance, portals are used to move from place to > place. But they are a specialization of inanimate > objects (things), which are a specialization of > general things (entities), which are a > specialization of the parent class (which is used > to avoid the withing problem). So, portal > specific operations can be found in > SAM.Entities.Things.Portals. The three (and > counting) specializations of Portals are only > referenced once to initialize them and let them > register themselves into the system. I could use > renames to flatten out the majority of references > (package SAM.Portals renames > SAM.Entities.Things.Portals;), but you can't > inherit from a rename, so the actual children are > still deeply nested. The long package names > usually mean long file names. This could become a > portability problem. > > I'm interested in how other people have dealt with > this problem, or suggestions for how i might deal > with it. The technique I've been using lately to good effect is to employ "use" clauses that eliminate all but the "bottom" package. E.g., for SAM.Entities.Things.Portals, I'd have a "use SAM.Entities.Things;", so then Portals components get referenced as "Portals.Teleport", for instance. This doesn't help with long filenames, but you can use gnatkr to aid cutting down the length of names. Marc A. Criley Quadrus Corporation www.quadruscorp.com