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 12:51:03 +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: 8bit Injection-Date: Thu, 23 Mar 2023 11:51:02 -0000 (UTC) Injection-Info: dont-email.me; posting-host="8f8a6c7e6deaf14d1d63deb97cbf29ad"; logging-data="1117431"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX187ip1k/dfXkcROaur7XqAw/J84N/iJjCg=" User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:102.0) Gecko/20100101 Thunderbird/102.9.0 Cancel-Lock: sha1:GGkVU1J0eZRY2Ueg/+kIbHDaqlY= In-Reply-To: Content-Language: en-US Xref: feeder.eternal-september.org comp.lang.ada:65011 List-Id: On 2023-03-22 15:10, G.B. wrote: > Some experiments point at the general access type. > >    type Foo_Ptr is access Foo; -- sans `all` >    X : Foo; >    P : Foo_Ptr := new Foo; >    type Foo1 is new Foo_Ptr (K => F1); > begin >    X := (F2, 1.0);   -- OK >    P.all := (F1, 3); -- _no_ Error! >    Foo1 (P).all := (F1, 3); > end Test; You get no error because you do not change the discriminant. Change your code to: P.all := (F2, 1.0); -- Error! > (Doesn't rejection for general access types seem reasonable > if assignment would otherwise require adjusting the storage > layout of a variable, including all access paths to components? > Just guessing.) I guess that an implementation must allocate memory for any value unless you constraint the discriminants in a subtype. But I am not a language lawyer to judge. -- Regards, Dmitry A. Kazakov http://www.dmitry-kazakov.de