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.191.7 with SMTP id p7mr10199748iof.130.1512267725800; Sat, 02 Dec 2017 18:22:05 -0800 (PST) X-Received: by 10.157.14.137 with SMTP id 9mr455491otj.14.1512267725698; Sat, 02 Dec 2017 18:22:05 -0800 (PST) Path: eternal-september.org!reader01.eternal-september.org!reader02.eternal-september.org!feeder.eternal-september.org!news.kjsl.com!usenet.stanford.edu!193no75284itr.0!news-out.google.com!s63ni1412itb.0!nntp.google.com!193no75283itr.0!postnews.google.com!glegroupsg2000goo.googlegroups.com!not-for-mail Newsgroups: comp.lang.ada Date: Sat, 2 Dec 2017 18:22:05 -0800 (PST) In-Reply-To: <9ffe40c0-59a6-408e-8104-6dcfea319366@googlegroups.com> 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> <102d4df8-d392-4100-9a37-c49705397e4e@googlegroups.com> <2240ea85-c247-4097-9877-24ce32a47123@googlegroups.com> <42736373-423a-42fb-8294-8a22fdb01e41@googlegroups.com> <9ffe40c0-59a6-408e-8104-6dcfea319366@googlegroups.com> User-Agent: G2/1.0 MIME-Version: 1.0 Message-ID: <60c0eabe-7b77-43d4-95da-fe87df70d6c2@googlegroups.com> Subject: Re: Extending a third party tagged type while adding finalization From: Jere Injection-Date: Sun, 03 Dec 2017 02:22:05 +0000 Content-Type: text/plain; charset="UTF-8" Xref: reader02.eternal-september.org comp.lang.ada:49324 Date: 2017-12-02T18:22:05-08:00 List-Id: On Tuesday, November 28, 2017 at 6:48:10 AM UTC-5, AdaMagica wrote: > Am Montag, 27. November 2017 20:53:59 UTC+1 schrieb Jere: > > > > The output for this is: > > Initialize C1 > > Initialize Final > > Initialize C2 > > Starting > > Finalize C2 > > Finalize Final > > Finalize C1 > > > > which is the same thing I was seeing with my version. Final is initialized > > before C2 and C2 is finalized before Final. > > Yes, that's a side effect of the selfreference. Too bad. > Yes indeed. This is why I initially said it couldn't be done safely. The self reference + dispatch causes out of order initialization and finalization. It can be done safely in specific cases, but not in general. I got this result from both my initial code and using the code from your paper. It makes sense now that I have had time to think about it more. Basically, I can add Initialization and Finalization to a descendant, but I cannot do so in a manner that further descendants can safely inherit it. I have to add it to each descendant manually (and avoid the classwide self reference) to keep safety.