From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on ip-172-31-65-14.ec2.internal X-Spam-Level: X-Spam-Status: No, score=-3.2 required=3.0 tests=BAYES_00,NICE_REPLY_A, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 Path: eternal-september.org!feeder.eternal-september.org!.POSTED!not-for-mail From: "Dmitry A. Kazakov" Newsgroups: comp.lang.ada Subject: Re: Assignment access type with discriminants Date: Thu, 23 Mar 2023 20:53:02 +0100 Organization: A noiseless patient Spider Message-ID: References: MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Injection-Date: Thu, 23 Mar 2023 19:53:00 -0000 (UTC) Injection-Info: dont-email.me; posting-host="8f8a6c7e6deaf14d1d63deb97cbf29ad"; logging-data="1358447"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+v0D0k7d2QIc17RQwuL9LtP+vkPGnzGrA=" User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:102.0) Gecko/20100101 Thunderbird/102.9.0 Cancel-Lock: sha1:cSbicB8arlwY1k7h+GhN88GwMA8= In-Reply-To: Content-Language: en-US Xref: feeder.eternal-september.org comp.lang.ada:65017 List-Id: On 2023-03-23 19:55, Niklas Holsti wrote: > Perhaps it would be better to make the assignment P := PF2.all'Access > illegal, because it in effect converts a constrained access value (PF2) > to an unconstrained access subtype (P), and so in some sense violates > the prohibition of constrained subtypes of general access types. Yes this is substitutability violation. Such cases never go without a punishment. In this case it is an implementation overhead. Consider: procedure Set (Destination : in out Foo; Source : Foo) is begin Destination := Source; end Set; The compiler cannot implement Set in a natural way, because Destination might be arbitrarily constrained by the caller. E.g. when the actual for Destination is P.all. So, the constraint must be passed together with the actual. A quite burden. -- Regards, Dmitry A. Kazakov http://www.dmitry-kazakov.de