From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00 autolearn=unavailable autolearn_force=no version=3.4.4 Path: eternal-september.org!reader01.eternal-september.org!reader02.eternal-september.org!news.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail From: Simon Wright Newsgroups: comp.lang.ada Subject: Re: Getting the index for an element in mutually referencing containers Date: Mon, 13 Mar 2017 23:25:40 +0000 Organization: A noiseless patient Spider Message-ID: References: <86o9xa36oq.fsf@gaheris.avalon.lan> <86k27xpikd.fsf@gaheris.avalon.lan> <86wpbxneuz.fsf@gaheris.avalon.lan> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: mx02.eternal-september.org; posting-host="454d7eb299451092211d3462ef3a5ff9"; logging-data="26999"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/mobu4Zhj+PLXulVUHw8/n5QEe4ZnjUVs=" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.1 (darwin) Cancel-Lock: sha1:MvDJapfNP6ILvZRkG7fnORdjvR0= sha1:Xoem9fnGqYXS9722PHSwmJNxEsU= Xref: news.eternal-september.org comp.lang.ada:29696 Date: 2017-03-13T23:25:40+00:00 List-Id: "Dmitry A. Kazakov" writes: > On 2017-03-12 17:44, Simon Wright wrote: >> "Dmitry A. Kazakov" writes: >> >>> On 2017-03-12 12:30, Simon Wright wrote: >>>> "Dmitry A. Kazakov" writes: >>>> >>>>> On 2017-03-11 22:46, Simon Wright wrote: >>>> >>>>>> Basically, I (Simon, now) am having trouble thinking of an >>>>>> application where reference counting would be an appropriate >>>>>> solution. >>>>> >>>>> As I said, in practice it is all cases when you would have a >>>>> container of mutable elements. >>>> >>>> I had some trouble understanding your point the first time, and >>>> skipped over it (sorry). >>>> >>>> What's the opposite of "mutable"? constant? because, if so, why >>>> wouldn't I use Update_Element? >>> >>> Yes, But it is almost never element update. Usually what you want is >>> to call some mutable operations on the element. The language does not >>> offer user-defined by-reference or copy-out-copy-in methods to element >>> access. >> >> with Ada.Containers.Vectors; >> package Mutable_Elements is >> type Element is record > > [...] > > Your example uses access type in Reference_Type which was the point. There may be pointers under the hood, just like in assembler there are registers which denote addresses in store, but there are no pointers explicitly in the code I wrote; so your assertion (that I couldn't call operations that change a container element) was wrong.