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=-0.2 required=5.0 tests=BAYES_00,FORGED_GMAIL_RCVD, FREEMAIL_FROM,FROM_STARTS_WITH_NUMS autolearn=no autolearn_force=no version=3.4.4 X-Received: by 2002:a6b:2209:: with SMTP id i9-v6mr4048947ioi.138.1527809991349; Thu, 31 May 2018 16:39:51 -0700 (PDT) X-Received: by 2002:aca:abc6:: with SMTP id u189-v6mr215234oie.2.1527809991204; Thu, 31 May 2018 16:39:51 -0700 (PDT) Path: eternal-september.org!reader01.eternal-september.org!reader02.eternal-september.org!feeder.eternal-september.org!news.linkpendium.com!news.linkpendium.com!news.snarked.org!border2.nntp.dca1.giganews.com!nntp.giganews.com!v8-v6no1386453itc.0!news-out.google.com!b185-v6ni1529itb.0!nntp.google.com!v8-v6no1386448itc.0!postnews.google.com!glegroupsg2000goo.googlegroups.com!not-for-mail Newsgroups: comp.lang.ada Date: Thu, 31 May 2018 16:39:50 -0700 (PDT) In-Reply-To: Complaints-To: groups-abuse@google.com Injection-Info: glegroupsg2000goo.googlegroups.com; posting-host=85.240.218.205; posting-account=rhqvKAoAAABpikMmPHJSZh4400BboHwT NNTP-Posting-Host: 85.240.218.205 References: User-Agent: G2/1.0 MIME-Version: 1.0 Message-ID: <33e69ed1-d4ba-4fd9-9d82-5b7cb1971596@googlegroups.com> Subject: Re: about inheritance of subtypes and entities (such as constants) related to a type in the same package From: Mehdi Saada <00120260a@gmail.com> Injection-Date: Thu, 31 May 2018 23:39:51 +0000 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Xref: reader02.eternal-september.org comp.lang.ada:52830 Date: 2018-05-31T16:39:50-07:00 List-Id: The idea was to define for a given (private) type, a series of subtypes wit= h different type invariant, or with or without unknown discriminants (the b= ox), to provide specific variant of the same ADT. I know now that is meant to be done through tagged types, and that subtypes= are no good for that. But I would have liked a mechanism to generate, why = deriving a new type from a parent, these tailored subtypes, with the same s= ame, just like they would have been rewritten. But it doesn't take much to see it wasn't a good idea, and that a lot probl= em would occur... like: what happens when the derived type has constraints = or invariants incompatible with subtypes associated with the parent ? I should say "Copying" rather than inheriting. "Copying" constants would fa= il for the same reason. I/one is better of with converting the constants de= fined once, for the whole type hierarchy. Though the problem is only with u= ntagged types, tagged private types have class-wide constants.