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:fc13:: with SMTP id r19-v6mr3273658ioh.7.1527351257755; Sat, 26 May 2018 09:14:17 -0700 (PDT) X-Received: by 2002:a9d:4795:: with SMTP id b21-v6mr630901otf.10.1527351257245; Sat, 26 May 2018 09:14:17 -0700 (PDT) Path: eternal-september.org!reader01.eternal-september.org!reader02.eternal-september.org!feeder.eternal-september.org!feeder3.usenet.farm!feed.usenet.farm!feeder.usenetexpress.com!feeder-in1.iad1.usenetexpress.com!border1.nntp.dca1.giganews.com!nntp.giganews.com!v8-v6no3365292itc.0!news-out.google.com!b185-v6ni2746itb.0!nntp.google.com!v8-v6no3365288itc.0!postnews.google.com!glegroupsg2000goo.googlegroups.com!not-for-mail Newsgroups: comp.lang.ada Date: Sat, 26 May 2018 09:14:17 -0700 (PDT) Complaints-To: groups-abuse@google.com Injection-Info: glegroupsg2000goo.googlegroups.com; posting-host=85.241.60.216; posting-account=rhqvKAoAAABpikMmPHJSZh4400BboHwT NNTP-Posting-Host: 85.241.60.216 User-Agent: G2/1.0 MIME-Version: 1.0 Message-ID: Subject: 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: Sat, 26 May 2018 16:14:17 +0000 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Xref: reader02.eternal-september.org comp.lang.ada:52699 Date: 2018-05-26T09:14:17-07:00 List-Id: Hello. In my reading of Barnes' book I learn many little details that aren'= t apparent in the rm... no surprise. Being used to much readability, I'm surprised, however, by the situation wi= th inheritance: with Ada.Text_IO; package AA is type A is private; subtype B is A; function IS_IN_B(obj: A) return boolean; procedure TEst_B (Obj_B: B) is Null; private type A is new Integer; end AA; So if I derive a new type from A in another package, it would inherit IS_IN= , but not the declaration of B ? This declaration would become anonymous an= d I would have to means to get, say, B'range or whatever attributes it has = ("private" was for convenience), but to look in package AA from where A com= es ? Also, no being able to do things like "pragma Assert (Obj in );" seems pretty lame. Or did I misunderstood something ? It could have been decided that subtypes of a type declared in the same pac= kage, are inherited as would be subprograms. Same goes for constants. Which= subtype B is mentioned (from A or C) would be resolved at least at compile= time. Having the same name isn't that good, but that's secondary.