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!feeder.eternal-september.org!aioe.org!.POSTED!not-for-mail From: "Dmitry A. Kazakov" Newsgroups: comp.lang.ada Subject: Re: How to get Ada to ?cross the chasm?? Date: Wed, 9 May 2018 10:37:21 +0200 Organization: Aioe.org NNTP Server Message-ID: References: <1c73f159-eae4-4ae7-a348-03964b007197@googlegroups.com> <87in88m43h.fsf@nightsong.com> <87efiuope8.fsf@nightsong.com> <87lgd1heva.fsf@nightsong.com> <87zi1gz3kl.fsf@nightsong.com> <878t8x7k1j.fsf@nightsong.com> <87k1sg2qux.fsf@nightsong.com> <87bmdp47is.fsf@nightsong.com> NNTP-Posting-Host: MyFhHs417jM9AgzRpXn7yg.user.gioia.aioe.org Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit X-Complaints-To: abuse@aioe.org User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:52.0) Gecko/20100101 Thunderbird/52.7.0 X-Notice: Filtered by postfilter v. 0.8.3 Content-Language: en-US Xref: reader02.eternal-september.org comp.lang.ada:52151 Date: 2018-05-09T10:37:21+02:00 List-Id: On 09/05/2018 09:23, Paul Rubin wrote: > "Dmitry A. Kazakov" writes: >> Yes, but my argument is that it only hides the logical error. The >> reference that is semantically weak acts as a strong one preventing >> collection of an unused object. Circular references are never right. > > I don't see the issue here. Circular linked lists are a venerable data > structure of which there are many assembly code examples in Knuth vol 1 > from the 1960s. Sure, but references in such a list should never be used for memory management. This is because a list is not an object/container, it a pair of steps down on the abstraction ladder. > Similarly, graphs are data and some of them have > cycles. Some algorithms might have trouble with cyclic data, but others > handle it ok. Graphs are exemplary for the need of a careful design with weak and strong references. BTW, reference counted nodes have an advantage that you can decide if the subgraph is shared with another task, and not to clone it before updating if it is not. My point is that all such situations are subject for careful design (of memory management in particular). GC is only an obstacle here. -- Regards, Dmitry A. Kazakov http://www.dmitry-kazakov.de