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,FREEMAIL_FROM autolearn=unavailable autolearn_force=no version=3.4.4 X-Received: by 10.36.65.229 with SMTP id b98mr1784695itd.20.1498758054104; Thu, 29 Jun 2017 10:40:54 -0700 (PDT) X-Received: by 10.36.160.9 with SMTP id o9mr126790ite.9.1498758054072; Thu, 29 Jun 2017 10:40:54 -0700 (PDT) Path: eternal-september.org!reader01.eternal-september.org!reader02.eternal-september.org!news.eternal-september.org!news.eternal-september.org!feeder.eternal-september.org!feed.usenet.farm!feeder4.usenet.farm!feeder.usenetexpress.com!feeder1.iad1.usenetexpress.com!border1.nntp.dca1.giganews.com!nntp.giganews.com!v202no65943itb.0!news-out.google.com!s132ni1844itb.0!nntp.google.com!188no131584itx.0!postnews.google.com!glegroupsg2000goo.googlegroups.com!not-for-mail Newsgroups: comp.lang.ada Date: Thu, 29 Jun 2017 10:40:53 -0700 (PDT) In-Reply-To: Complaints-To: groups-abuse@google.com Injection-Info: glegroupsg2000goo.googlegroups.com; posting-host=2601:191:8303:2100:5985:2c17:9409:aa9c; posting-account=fdRd8woAAADTIlxCu9FgvDrUK4wPzvy3 NNTP-Posting-Host: 2601:191:8303:2100:5985:2c17:9409:aa9c References: <82a59ee9-8d55-4c73-9daf-e9f7d9ab8a8f@googlegroups.com> User-Agent: G2/1.0 MIME-Version: 1.0 Message-ID: <6f0ea00c-6cf2-4616-9cd0-66e8b4619332@googlegroups.com> Subject: Re: derived formal types and known discriminants From: Robert Eachus Injection-Date: Thu, 29 Jun 2017 17:40:54 +0000 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Xref: news.eternal-september.org comp.lang.ada:47184 Date: 2017-06-29T10:40:53-07:00 List-Id: On Thursday, June 29, 2017 at 10:39:47 AM UTC-4, Dmitry A. Kazakov wrote: > On 29/06/2017 16:15, sbelmont700@gmail.com wrote: >=20 > > You imply that the feature is little-used, but isn't this (one of) > > the primary mechanisms for MI via the so-called "mixin"? In Mr. > > Taft's paper from 1994 ("Multiple Inheritance in Ada 9X"), he lists > > the three common cases, of which #2 is the "generic with a formal > > derived type" method, i.e. instead of having C extend both A and B, > > you make one of the parents a generic that extends a formal derived > > type of the other, and than have the child and extend that. > Speaking from my sad experience it creates such a mess no real-life=20 > project can allow. I guess other people either tried it like me or were= =20 > wise enough not to. I've done it, it works, but to make it manageable/maintainable takes a bit = of discipline. The actual project was a mailbox system so that distributed= programs could send (and receive) messages without having to worry about t= he actual system support. (In particular whether programs shared memory, o= r messages required copying bytes.) The base type Message had no discriminants. This could be extended by mix-= ins with discriminants to allow arrays and records to be passed. You could= use multiple mixins, but if two content types both needed discriminants, t= he best solution was to wrap them a record type and use a mixin for that. Worked fine. Last I heard someone was trying to extend it to allow passing= data between programs running in virtual memory on the same hardware witho= ut extra copying. (I'm not expressing that well. A memory pool shared bet= ween the programs. It seemed much easier to me to run all the programs in = the same virtual space to begin with. But it was not my project...)