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=-1.7 required=3.0 tests=BAYES_00,NICE_REPLY_A, REPLYTO_WITHOUT_TO_CC,T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.6 Path: eternal-september.org!reader01.eternal-september.org!.POSTED!not-for-mail From: "G.B." Newsgroups: comp.lang.ada Subject: Re: Carbon Date: Fri, 2 Sep 2022 16:18:08 +0200 Organization: A noiseless patient Spider Message-ID: References: <993af397-b615-44e7-ae8d-ec706f9b6098n@googlegroups.com> <5f819cdd-e763-4a96-aed5-545d57edac23n@googlegroups.com> <877d2u21ps.fsf@nightsong.com> <8735di1y6a.fsf@nightsong.com> <87ler9ywye.fsf@nightsong.com> Reply-To: nonlegitur@notmyhomepage.de MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit Injection-Date: Fri, 2 Sep 2022 14:18:09 -0000 (UTC) Injection-Info: reader01.eternal-september.org; posting-host="5639c12420f6fcdb7228ac9800e932ad"; logging-data="2686391"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19vmC7N5WW5M4Za3NjEckSKBDIdeVGN3HA=" User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:91.0) Gecko/20100101 Thunderbird/91.13.0 Cancel-Lock: sha1:GF01jdOCdOzWqNWkF+bskhLxNlM= Content-Language: en-US In-Reply-To: Xref: reader01.eternal-september.org comp.lang.ada:64273 List-Id: On 01.09.22 08:46, J-P. Rosen wrote: > Le 28/08/2022 à 19:34, G.B. a écrit : >> Also the convenience of being able to compare two objects for >> being the same object, using "===" in some languages---out of the box! >> >> procedure same_object (A : T; B in out T) is >> begin >>    what_do_i_put_here; --  ? >      A'Has_Same_Storage (B); >> end same_object; > > Of course, this procedure should be a function... Cool, new attributes. Is the expectation that A and B occupy the same bits if I pass the same X as an actual for both? procedure Same is type T is range 1 .. 10; function Same_Objects (A : T; B : in out T) return Boolean is begin return A'Has_Same_Storage (B); end Same_Objects; X : T := 5 with volatile; -- Make GNAT make X an object What : exception; begin if not X'Has_Same_Storage(X) then raise What; end if; if not Same_Objects (X, X) then raise Program_Error; -- does raise end if; end Same;