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: Paul Rubin Newsgroups: comp.lang.ada Subject: Re: Getting the index for an element in mutually referencing containers Date: Wed, 15 Mar 2017 19:59:18 -0700 Organization: A noiseless patient Spider Message-ID: <87o9x26i61.fsf@nightsong.com> References: <86o9xa36oq.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="6570f531aeee3ed47e8d4018bc1a1e43"; logging-data="599"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19AQ7QikxSl1X9q+a0dVWOh" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3 (gnu/linux) Cancel-Lock: sha1:bgKyl59zxyqwRq2YOt3IvuUbWDg= sha1:8lE04fiUNk2+uRRZPx5LHEqw6o8= Xref: news.eternal-september.org comp.lang.ada:33516 Date: 2017-03-15T19:59:18-07:00 List-Id: "Randy Brukardt" writes: > I don't recall ever needing both "strong" or "weak" references to any data > structure. I've only heard of weakrefs in connection with garbage collected systems, but they are useful there, for dealing with potentially circular references between long-lived objects. > Most structures only need short-lived references, and the ones > that need long-lived ones are almost always permanent That's partly a matter of how the application is organized, which in turn is influenced by the language features. In particular, with GC available, it suddenly becomes less important to carefully manage object lifetimes and so you get a mixture. Of course then it's hard to prove impossibility of OOM crashes, so this may not be a great approach for critical realtime systems. But for lots of other tasks it makes programming easier at the now-cheap cost of a few more computer resources.