comp.lang.ada
 help / color / mirror / Atom feed
From: Egil H H <ehh.public@gmail.com>
Subject: Re: Type invariants and private extensions?
Date: Mon, 11 Sep 2017 15:06:44 -0700 (PDT)
Date: 2017-09-11T15:06:44-07:00	[thread overview]
Message-ID: <3acce676-90f7-4e29-9096-b711c69f6ae5@googlegroups.com> (raw)
In-Reply-To: <op7125$1186$1@gioia.aioe.org>

On Tuesday, September 12, 2017 at 12:00:41 AM UTC+2, Victor Porton wrote:
> 
> It seems that you don't understand me: I need different boolean functions 
> for different derived tagged types. If we specify Type_Invariant or 
> Type_Invariant'Class this is the same function because it can be specified 
> only for the base class not my derived classes.
> 
> Or maybe I do not understand you? If so, please explain.
> 
> Hm, well, Type_Invariant'Class may point to dispatching function which can 
> be overridden in the derived classes. Isn't it what you mean?
> 
> 

Any Invariants declared for a parent type must also hold for all derived types, but derived types can add more. Think about what someone holding a variable of Parent'Class expects. The definition of Parent promises an invariant. 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.


  reply	other threads:[~2017-09-11 22:06 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-09-11 19:51 Type invariants and private extensions? Victor Porton
2017-09-11 20:00 ` Egil H H
2017-09-11 20:48   ` Victor Porton
2017-09-11 21:19     ` Egil H H
2017-09-11 21:27       ` Victor Porton
2017-09-11 21:49         ` Egil H H
2017-09-11 22:00           ` Victor Porton
2017-09-11 22:06             ` Egil H H [this message]
2017-09-12  7:30             ` Dmitry A. Kazakov
2017-09-11 22:00         ` Jere
2017-09-11 22:02           ` Victor Porton
2017-09-12 18:26             ` Jeffrey R. Carter
2017-09-12 18:54               ` Victor Porton
2017-09-12 19:56                 ` Jeffrey R. Carter
2017-09-12 20:08                   ` Victor Porton
2017-09-12 22:34                     ` Shark8
2017-09-12 22:59                       ` Victor Porton
2017-09-13  4:21                         ` Jere
2017-09-13  4:28                           ` Jere
2017-09-13  4:34                             ` Jere
2017-09-14 13:52                           ` Victor Porton
2017-09-15  0:48                             ` Jere
2017-09-16 14:22                               ` Victor Porton
2017-09-14  7:28                         ` Shark8
2017-09-14 13:56                           ` Victor Porton
2017-09-14 13:58                             ` Victor Porton
2017-09-11 22:48         ` Shark8
2017-10-02 23:16         ` Randy Brukardt
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox