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!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.rrsoftware.com!not-for-mail From: "Randy Brukardt" Newsgroups: comp.lang.ada Subject: Re: Type invariants and private extensions? Date: Mon, 2 Oct 2017 18:16:16 -0500 Organization: JSA Research & Innovation Message-ID: References: <364ff8e0-c7dd-4980-b19f-5d438edd8353@googlegroups.com> <7df81b3c-1fde-4395-8b9b-1a945820a7f7@googlegroups.com> Injection-Date: Mon, 2 Oct 2017 23:16:16 -0000 (UTC) Injection-Info: franka.jacob-sparre.dk; posting-host="rrsoftware.com:24.196.82.226"; logging-data="19504"; mail-complaints-to="news@jacob-sparre.dk" 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.7246 Xref: news.eternal-september.org comp.lang.ada:48296 Date: 2017-10-02T18:16:16-05:00 List-Id: "Victor Porton" wrote in message news:op6v4m$tmm$1@gioia.aioe.org... > Egil H H wrote: > >> On Monday, September 11, 2017 at 10:48:46 PM UTC+2, Victor Porton wrote: >>> > The Invariant will then be inherited by all derived types >>> >>> It is not what I want. I want different invariants for different derived >>> types. >>> >> >> You can add new invariants in addition to the ones inherited > > I cannot: the compiler gives an error: > > package P is > > type T is tagged private; > > private > > type T is tagged null record; > > end P; > > with P; use P; > > package P1 is > > type T1 is new T with null record > with Type_Invariant => True; > > end P1; Right, but you can define a private extension: package P1 is type T1 is new T with private; private type T1 is new T with null record with Type_Invariant => True; end P1; The semantics is the same as with a plain record extension, and the invariant makes more sense. Randy.