comp.lang.ada
 help / color / mirror / Atom feed
From: "Randy Brukardt" <randy@rrsoftware.com>
Subject: Re: derived formal types and known discriminants
Date: Thu, 29 Jun 2017 20:10:40 -0500
Date: 2017-06-29T20:10:40-05:00	[thread overview]
Message-ID: <oj48eg$lc9$1@franka.jacob-sparre.dk> (raw)
In-Reply-To: 82a59ee9-8d55-4c73-9daf-e9f7d9ab8a8f@googlegroups.com

<sbelmont700@gmail.com> wrote in message 
news:82a59ee9-8d55-4c73-9daf-e9f7d9ab8a8f@googlegroups.com...
On Friday, June 23, 2017 at 1:26:12 PM UTC-4, Randy Brukardt 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"?

Ada 2005 got interfaces for proper interface inheritance. Mix-ins don't get 
used much in new code.

In any case, tagged formal derived types was the case I was referring to 
when I said "Yes, formal tagged derived types have some uses in deep type 
hierarchies, and that's about it, because no one declares other kinds of 
derived types in the first place." They're the only useful type of formal 
derived types, but the majority of the compilication comes from the other 
kinds.

...
>But if I understand it (quite likely not the case...), this effectively 
>limits
>this method to parent types without discriminants?

Surely, but no real loss. Using discriminants with tagged types is pretty 
rare in itself. So is useful multiple inheritance. That makes the 
probability of needing both very small.

My recollection is that Ada 95 didn't even allow discriminants on tagged 
types at various points in its development, because of the raft of semantic 
problems that occur. Those eventually were solved by getting rid of the 
possibility of changing the discriminants.

Personally, I find that discriminants are only useful if they are mutable 
(that is, can be changed via assignment), and as noted above, tagged 
discriminants are never mutable. Non-mutable discriminants are inflexible 
and usually just get in the way (arrays have a similar problem with their 
bounds). YMMV.

                                    Randy.




  parent reply	other threads:[~2017-06-30  1:10 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
2017-06-30  1:10     ` Randy Brukardt [this message]
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