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!mx02.eternal-september.org!.POSTED!not-for-mail From: "Jeffrey R. Carter" Newsgroups: comp.lang.ada Subject: Re: Running a preprocessor from GPS? Date: Thu, 30 Jul 2015 15:52:40 -0700 Organization: Also freenews.netfront.net; news.tornevall.net; news.eternal-september.org 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> Mime-Version: 1.0 Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit Injection-Date: Thu, 30 Jul 2015 22:51:09 +0000 (UTC) Injection-Info: mx02.eternal-september.org; posting-host="ee44d3db9c41f5ad88d7e8e8f0268f05"; logging-data="30870"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/ycThpnjUycPWM0YqlDdGFRCaMvTdWMho=" User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.1.0 In-Reply-To: <4cb32c40-f659-490d-bbb6-73585fc069e8@googlegroups.com> Cancel-Lock: sha1:sN9pVp8OjRi0SQDx71cOik5Ii04= X-Enigmail-Draft-Status: N1110 Xref: news.eternal-september.org comp.lang.ada:27245 Date: 2015-07-30T15:52:40-07:00 List-Id: On 07/30/2015 01:53 PM, EGarrulo wrote: > > By "resource" I mean any resource -- like: database connections, > files, etc. -- that must be relinquished as soon as possible and that is > shared among different objects, in a way that makes it difficult for each object > to determine whether such resource is still needed by other objects or not. Of > course, this implies a dynamic environment that precludes the possibility of > creating all the needed resources in advance and then releasing them at the end > of computation. I still have no idea what you mean. Sharing a DB connection among objects seems simple: declare DB : DB_Connection; begin O1.Op (DB => DB); O2.Op (DB => DB); O3.Op (DB => DB); end; and the sharing part remains just as simple if the operations pass the DB to operations of other objects, and if the code is more complex with multiple paths and orders of operation invocations. There doesn't seem to be any reason for the objects to know whether another object will receive the DB after they're through with it or not, or to be concerned with when it is "relinquished". > I am not thinking in C++ terms. I am thinking in terms of patterns > that I know for managing resources. 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. If you only know one idiom, it's not surprising you have difficulty imagining anything else. "Shared/weak pointer" certainly sounds fairly C/++ oriented to me. I am perhaps constrained by my Ada experience since I can't image what kind of problem you're talking about. I wish I could. It reminds me of someone who was telling me about his experiments with overflowing buffers in C. I said I preferred to use a language in which that wasn't possible, and he couldn't conceive of the possibility. He showed me what he was doing, which was something like char b[100]; and using strcpy to copy argv[1] into b. He asked how I'd do that with Ada, so I showed him B : String := Ada.Command_Line.Argument (1); He didn't seem to be able to wrap his mind around that. I may be having a similar problem understanding you. -- Jeff Carter "Pray that there's intelligent life somewhere up in space, 'cause there's bugger all down here on earth." Monty Python's Meaning of Life 61