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,FREEMAIL_FROM autolearn=unavailable autolearn_force=no version=3.4.4 X-Received: by 10.98.57.152 with SMTP id u24mr6988989pfj.42.1505167605520; Mon, 11 Sep 2017 15:06:45 -0700 (PDT) X-Received: by 10.36.95.213 with SMTP id r204mr653567itb.10.1505167605375; Mon, 11 Sep 2017 15:06:45 -0700 (PDT) Path: eternal-september.org!reader01.eternal-september.org!reader02.eternal-september.org!news.eternal-september.org!feeder.eternal-september.org!border1.nntp.ams1.giganews.com!border2.nntp.ams1.giganews.com!nntp.giganews.com!peer01.ams1!peer.ams1.xlned.com!news.xlned.com!peer02.am4!peer.am4.highwinds-media.com!peer02.iad!feed-me.highwinds-media.com!news.highwinds-media.com!127no36614itw.0!news-out.google.com!p6ni28itp.0!nntp.google.com!o200no37227itg.0!postnews.google.com!glegroupsg2000goo.googlegroups.com!not-for-mail Newsgroups: comp.lang.ada Date: Mon, 11 Sep 2017 15:06:44 -0700 (PDT) In-Reply-To: Complaints-To: groups-abuse@google.com Injection-Info: glegroupsg2000goo.googlegroups.com; posting-host=51.174.245.155; posting-account=uulyKwoAAAA86DO0ODu--rZtbje8Sytn NNTP-Posting-Host: 51.174.245.155 References: <364ff8e0-c7dd-4980-b19f-5d438edd8353@googlegroups.com> <7df81b3c-1fde-4395-8b9b-1a945820a7f7@googlegroups.com> User-Agent: G2/1.0 MIME-Version: 1.0 Message-ID: <3acce676-90f7-4e29-9096-b711c69f6ae5@googlegroups.com> Subject: Re: Type invariants and private extensions? From: Egil H H Injection-Date: Mon, 11 Sep 2017 22:06:45 +0000 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Received-Body-CRC: 3005183732 X-Received-Bytes: 2473 Xref: news.eternal-september.org comp.lang.ada:48024 Date: 2017-09-11T15:06:44-07:00 List-Id: On Tuesday, September 12, 2017 at 12:00:41 AM UTC+2, Victor Porton wrote: >=20 > It seems that you don't understand me: I need different boolean functions= =20 > for different derived tagged types. If we specify Type_Invariant or=20 > Type_Invariant'Class this is the same function because it can be specifie= d=20 > only for the base class not my derived classes. >=20 > Or maybe I do not understand you? If so, please explain. >=20 > Hm, well, Type_Invariant'Class may point to dispatching function which ca= n=20 > be overridden in the derived classes. Isn't it what you mean? >=20 >=20 Any Invariants declared for a parent type must also hold for all derived ty= pes, but derived types can add more. Think about what someone holding a var= iable of Parent'Class expects. The definition of Parent promises an invaria= nt. But what if the actual type is a child? Mayhem will ensue if the child = does not promise the same invariant, hence it is inherited.