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.104.6 with SMTP id d6mr11913647ioc.138.1512329661185; Sun, 03 Dec 2017 11:34:21 -0800 (PST) X-Received: by 10.157.51.145 with SMTP id u17mr553746otc.7.1512329661072; Sun, 03 Dec 2017 11:34:21 -0800 (PST) Path: eternal-september.org!reader01.eternal-september.org!reader02.eternal-september.org!feeder.eternal-september.org!news.kjsl.com!usenet.stanford.edu!193no541044itr.0!news-out.google.com!s63ni2428itb.0!nntp.google.com!i6no2236613itb.0!postnews.google.com!glegroupsg2000goo.googlegroups.com!not-for-mail Newsgroups: comp.lang.ada Date: Sun, 3 Dec 2017 11:34:20 -0800 (PST) In-Reply-To: Complaints-To: groups-abuse@google.com Injection-Info: glegroupsg2000goo.googlegroups.com; posting-host=2003:c7:83d0:5c29:9898:175d:89d9:bdbc; posting-account=rmHyLAoAAADSQmMWJF0a_815Fdd96RDf NNTP-Posting-Host: 2003:c7:83d0:5c29:9898:175d:89d9:bdbc 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> <037e7f02-9149-4648-b7c5-91f67c1c1961@googlegroups.com> User-Agent: G2/1.0 MIME-Version: 1.0 Message-ID: Subject: Re: Extending a third party tagged type while adding finalization From: AdaMagica Injection-Date: Sun, 03 Dec 2017 19:34:21 +0000 Content-Type: text/plain; charset="UTF-8" Xref: reader02.eternal-september.org comp.lang.ada:49336 Date: 2017-12-03T11:34:20-08:00 List-Id: Am Sonntag, 3. Dezember 2017 10:29:07 UTC+1 schrieb Dmitry A. Kazakov: Didn't try to compile but can't be legal. Nonabstract type has abstract primitive operation. not null anonymous access type has nothing assigned. > type T is new Ada.Finalization.Controlled with record > Self : not null access T'Class; > end record; > procedure Initialize (X : in out T); > procedure Foo (X : in out T) is abstract; > > type S is new T with ... > overriding procedure Foo (X : in out S); > > procedure Initialize (X : in out T) is > begin > X.Self.Foo; -- Boom! > end Initialize; > > Dispatching calls must be illegal during type-specific > initialization/finalization. They are OK after these in the class-wide > initialization or before in the class-wide finalization. > > > I was just musing about whether there was a different way > > to do it. > > Yes, there is no need to keep lists of objects. It is enough to have > only static analysis to decide what kind of finalization to call. Nobody > cares about finalization of implicitly collected objects, it is a bug > anyway. > > > 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. > > Welcome in the club. > > -- > Regards, > Dmitry A. Kazakov > http://www.dmitry-kazakov.de