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=-0.3 required=5.0 tests=BAYES_00, REPLYTO_WITHOUT_TO_CC autolearn=no autolearn_force=no version=3.4.4 Path: eternal-september.org!reader01.eternal-september.org!reader02.eternal-september.org!news.eternal-september.org!mx02.eternal-september.org!feeder.eternal-september.org!aioe.org!.POSTED!not-for-mail From: "Dmitry A. Kazakov" Newsgroups: comp.lang.ada Subject: Re: Running a preprocessor from GPS? Date: Fri, 31 Jul 2015 11:13:07 +0200 Organization: cbb software GmbH Message-ID: References: <2df4698f-4c8e-457c-822d-209cb2f8ab5e@googlegroups.com> <014427b1-ff7a-4a69-82e6-0330af77ed96@googlegroups.com> <91f88d79-197c-419f-84a8-908e05967a2c@googlegroups.com> <135c2b00-d13c-4f5d-a586-8aca442d363b@googlegroups.com> <87380683vc.fsf@adaheads.sparre-andersen.dk> <347c6be9-c918-4bc0-9494-c93cd6740def@googlegroups.com> <4cb32c40-f659-490d-bbb6-73585fc069e8@googlegroups.com> Reply-To: mailbox@dmitry-kazakov.de NNTP-Posting-Host: ChlmA4XFxcJoDoqGdDSflw.user.speranza.aioe.org Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit X-Complaints-To: abuse@aioe.org User-Agent: 40tude_Dialog/2.0.15.1 X-Notice: Filtered by postfilter v. 0.8.2 Xref: news.eternal-september.org comp.lang.ada:27258 Date: 2015-07-31T11:13:07+02:00 List-Id: On Fri, 31 Jul 2015 09:26:17 +0100, Simon Wright wrote: > EGarrulo writes: > >> So far, I only know the "shared/weak pointer" idiom. If Ada offers >> something else, besides manual reclamation, I am eager to learn about >> it. > > Would ref-counted smart pointers suit you? I'd address your problem by > having a smart pointer to a limited-controlled object representing the > resource, whose finalization would clean up the resource. Your pointer is a "hard" (AKA strong) reference/pointer, i.e. the target is not collected until at least pointer exists. Soft/weak reference/pointer is a pointer that does not prevent collection, but itself becomes invalid if collection occurs. [To access the target, a strong pointer is obtained from the weak pointer, the object is accessed through it, and then the strong pointer is disposed.] If there is a complex mesh of references some references must be weak to prevent circular references: O1-->hard-->O2 <--soft-- Yes, there exist many implementations in Ada *and* there is no reason to have it in the language, as it can be implemented at the library level. -- Regards, Dmitry A. Kazakov http://www.dmitry-kazakov.de