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.107.183.193 with SMTP id h184mr10210974iof.129.1512269266482; Sat, 02 Dec 2017 18:47:46 -0800 (PST) X-Received: by 10.157.5.211 with SMTP id 77mr457420otd.0.1512269266350; Sat, 02 Dec 2017 18:47:46 -0800 (PST) Path: eternal-september.org!reader01.eternal-september.org!reader02.eternal-september.org!feeder.eternal-september.org!news.kjsl.com!usenet.stanford.edu!i6no1778059itb.0!news-out.google.com!s63ni1412itb.0!nntp.google.com!193no86987itr.0!postnews.google.com!glegroupsg2000goo.googlegroups.com!not-for-mail Newsgroups: comp.lang.ada Date: Sat, 2 Dec 2017 18:47:46 -0800 (PST) In-Reply-To: Complaints-To: groups-abuse@google.com Injection-Info: glegroupsg2000goo.googlegroups.com; posting-host=173.71.208.22; posting-account=QF6XPQoAAABce2NyPxxDAaKdAkN6RgAf NNTP-Posting-Host: 173.71.208.22 References: <4db43571-7f86-4e73-8849-c41160927703@googlegroups.com> <6496a10f-c97e-4e42-b295-2478ad464b2f@googlegroups.com> <6106dfe6-c614-4fc1-aace-74bf8d7435e3@googlegroups.com> <24767ee5-cda8-45e4-98d1-7da44757bd40@googlegroups.com> User-Agent: G2/1.0 MIME-Version: 1.0 Message-ID: <037e7f02-9149-4648-b7c5-91f67c1c1961@googlegroups.com> Subject: Re: Extending a third party tagged type while adding finalization From: Jere Injection-Date: Sun, 03 Dec 2017 02:47:46 +0000 Content-Type: text/plain; charset="UTF-8" Xref: reader02.eternal-september.org comp.lang.ada:49325 Date: 2017-12-02T18:47:46-08:00 List-Id: On Monday, November 27, 2017 at 8:55:19 PM UTC-5, Randy Brukardt wrote: > "Jere" wrote in message > ... > >> Based on what I have read so far, I didn't see any discussion that would > >> lead me to think this will be changed at least in the near future. I > >> wish there was a way it would be easy for vendors to do something like: > >> > >> type Some_Type is tagged private; > >> for Some_Type'Initialize use Initialize_Some_Type; > >> for Some_Type'Adjust use Adjust_Some_Type; > >> for Some_Type'Finalize use Finalize_Some_Type; > >> > >> and then just have the compiler handle adding the needed structures > >> to the type under the hood (like how GNAT uses Controlled to hold > >> a linked list under the hood...but compiler managed). > > The only way this could be made to work in Janus/Ada would be for all tagged > types to be controlled, which would waste time and space for types that > aren't actually controlled. Since Janus/Ada was designed to be > space-efficient, that would be going directly against our primary goal - not > something I'd do without a fight. > > Randy. Well, I am definitely not advocating that all tagged types need to be controlled. I was just musing about whether there was a different way to do it. The Ada Finalization method is very clunky and can be limiting at times. There may not be a better way to do it. At the end of the day, I find a lot of the errors our programmers make is forgetting to put in a Create/Intialize or Clean_Up/Finalize call on objects that do not have Controlled ancestors. It's a maintenance headache, so I look for ways to try to remedy that via design.