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=unavailable autolearn_force=no version=3.4.4 Path: eternal-september.org!reader01.eternal-september.org!reader02.eternal-september.org!news.eternal-september.org!news.eternal-september.org!feeder.eternal-september.org!nntp-feed.chiark.greenend.org.uk!ewrotcd!newsfeed.xs3.de!io.xs3.de!news.jacob-sparre.dk!franka.jacob-sparre.dk!pnx.dk!.POSTED!not-for-mail From: "Randy Brukardt" Newsgroups: comp.lang.ada Subject: Re: derived formal types and known discriminants Date: Thu, 29 Jun 2017 20:10:40 -0500 Organization: JSA Research & Innovation Message-ID: References: <82a59ee9-8d55-4c73-9daf-e9f7d9ab8a8f@googlegroups.com> NNTP-Posting-Host: rrsoftware.com X-Trace: franka.jacob-sparre.dk 1498785041 21897 24.196.82.226 (30 Jun 2017 01:10:41 GMT) X-Complaints-To: news@jacob-sparre.dk NNTP-Posting-Date: Fri, 30 Jun 2017 01:10:41 +0000 (UTC) X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2900.5931 X-RFC2646: Format=Flowed; Original X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.6157 Xref: news.eternal-september.org comp.lang.ada:47201 Date: 2017-06-29T20:10:40-05:00 List-Id: 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.