comp.lang.ada
 help / color / mirror / Atom feed
From: Robert Eachus <rieachus@comcast.net>
Subject: Re: derived formal types and known discriminants
Date: Thu, 29 Jun 2017 10:40:53 -0700 (PDT)
Date: 2017-06-29T10:40:53-07:00	[thread overview]
Message-ID: <6f0ea00c-6cf2-4616-9cd0-66e8b4619332@googlegroups.com> (raw)
In-Reply-To: <oj33ff$9em$1@gioia.aioe.org>

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:
> 
> > 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 
> project can allow. I guess other people either tried it like me or were 
> 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 the actual system support.  (In particular whether programs shared memory, or 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, the 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 without extra copying.  (I'm not expressing that well.  A memory pool shared between 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...)


  reply	other threads:[~2017-06-29 17:40 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-06-23  0:45 derived formal types and known discriminants sbelmont700
2017-06-23 17:26 ` Randy Brukardt
2017-06-29 14:15   ` sbelmont700
2017-06-29 14:39     ` Dmitry A. Kazakov
2017-06-29 17:40       ` Robert Eachus [this message]
2017-06-30  1:10     ` Randy Brukardt
2017-06-30  7:24       ` Dmitry A. Kazakov
2017-06-30 18:09         ` Randy Brukardt
2017-07-04  0:30           ` sbelmont700
2017-07-04  1:36             ` gautier_niouzes
2017-07-04  2:29             ` Randy Brukardt
2017-07-04  7:09             ` Dmitry A. Kazakov
2017-07-04 17:34               ` Shark8
2017-07-03 17:24 ` Jere
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox