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.9 required=3.0 tests=BAYES_00,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 Path: eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail From: Simon Wright Newsgroups: comp.lang.ada Subject: Re: strange cursor in nested containers Date: Thu, 20 Apr 2023 15:59:35 +0100 Organization: A noiseless patient Spider Message-ID: References: <6aa39f27-62ca-4486-9fc7-1c713da5b098n@googlegroups.com> MIME-Version: 1.0 Content-Type: text/plain Injection-Info: dont-email.me; posting-host="9fefc01f5d17daffe51cd7c6729b1277"; logging-data="688487"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX181aGWKO0DQ7708hf0C7FIJXrqdXxarwZA=" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.1 (darwin) Cancel-Lock: sha1:gL2qlm4mocVEC/nm7RzQM8L3WLM= sha1:QJPbpeAiZUmUOYhNmZ+397eucmo= Xref: news.eternal-september.org comp.lang.ada:65120 List-Id: Egil H H writes: > Each call to `element(n)` returns a _copy_ of the element, which in > this case includes the enitre doubly linked list This is indeed the problem, thanks! I hadn't considered the effect of renaming a function call; the cursor constructed inside query_net refers to the locally renamed copy of type_net, which will be destroyed on exit from query_net. > (and since `net` is a > renames of `element(n), you would have gotten multiple copies if you > had called `net` multiple times inside query net) This appears to say that this renaming of a function call results in something like a macro, but I think that R : T renames Func; is more like R : constant T := Func; ARM 8.5(3) says "The elaboration of a renaming_declaration evaluates the name that follows the reserved word renames and thereby determines the view and entity denoted by this name (the renamed view and renamed entity). A name that denotes the renaming_declaration denotes (a new view of) the renamed entity."