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,FREEMAIL_FROM autolearn=unavailable autolearn_force=no version=3.4.4 X-Received: by 10.182.213.166 with SMTP id nt6mr51816014obc.3.1438284778008; Thu, 30 Jul 2015 12:32:58 -0700 (PDT) X-Received: by 10.50.171.200 with SMTP id aw8mr80615igc.6.1438284777989; Thu, 30 Jul 2015 12:32:57 -0700 (PDT) Path: eternal-september.org!reader01.eternal-september.org!reader02.eternal-september.org!news.eternal-september.org!mx02.eternal-september.org!feeder.eternal-september.org!news.glorb.com!f3no5080431igg.0!news-out.google.com!z8ni68ign.0!nntp.google.com!f3no5080425igg.0!postnews.google.com!glegroupsg2000goo.googlegroups.com!not-for-mail Newsgroups: comp.lang.ada Date: Thu, 30 Jul 2015 12:32:57 -0700 (PDT) In-Reply-To: Complaints-To: groups-abuse@google.com Injection-Info: glegroupsg2000goo.googlegroups.com; posting-host=81.203.145.32; posting-account=AFCLjAoAAABJAOf_HjgEEEi3ty-lG5m2 NNTP-Posting-Host: 81.203.145.32 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> User-Agent: G2/1.0 MIME-Version: 1.0 Message-ID: <2ac21830-619c-4145-ab99-d6036bd4ed30@googlegroups.com> Subject: Re: Running a preprocessor from GPS? From: EGarrulo Injection-Date: Thu, 30 Jul 2015 19:32:57 +0000 Content-Type: text/plain; charset=ISO-8859-1 Xref: news.eternal-september.org comp.lang.ada:27241 Date: 2015-07-30T12:32:57-07:00 List-Id: On Thursday, July 30, 2015 at 8:56:01 PM UTC+2, Randy Brukardt wrote: > "EGarrulo" wrote in message > ... > > > >> In Ada, use the stack, if possible! > >> In Ada 2005, use containers, if possible! > > > > Otherwise use C++ and its "shared/weak pointer" support ;) > > We had a proposal for adding that to Ada, and it just was a complete mess. I wonder why. Smart pointers are conceptually simple. Sure, Ada tries to provide bullet-proof solutions, but that is difficult, for pointers. > But seriously, if you can't use the stack and/or containers in Ada 2005 and > later, you're already into a fairly unlikely problem. And then you can use > one of the various "smart pointer" packages out there; those do reference > counting and hide that behind the various syntax sugar techniques of Ada > 2012. (See Christophe Grein's package, for example.) There's an argument > that one of those packages should get added to the Ada.Containers hierarchy > (someone should propose that on Ada-Comment). > > Anyway, unless you are implementing a container, the need to use access > types directly (and thus do the storage management directly) is pretty rare. > And if you are implementing a container, you can limit the management to > that container (thus taking the problem out of the hands of clients). Unfortunately, it is clear that I haven't been clear enough (the *curse of knowledge* has hit me, too). This is because, as a former C++ programmer, I tie memory and resources because -- in C++ -- the idiom is that you take care of the memory, and the system will take care of the tied resources. Hence, my problem is not memory alone. It seems that the package that you have suggested addresses the problem, albeit it doesn't provide weak pointers.