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.143.132 with SMTP id r126mr12021353iod.7.1511354621339; Wed, 22 Nov 2017 04:43:41 -0800 (PST) X-Received: by 10.157.95.5 with SMTP id f5mr868848oti.9.1511354621268; Wed, 22 Nov 2017 04:43:41 -0800 (PST) Path: eternal-september.org!reader01.eternal-september.org!reader02.eternal-september.org!feeder.eternal-september.org!news.kjsl.com!usenet.stanford.edu!d140no3583078itd.0!news-out.google.com!x87ni2328ita.0!nntp.google.com!i6no3587587itb.0!postnews.google.com!glegroupsg2000goo.googlegroups.com!not-for-mail Newsgroups: comp.lang.ada Date: Wed, 22 Nov 2017 04:43:41 -0800 (PST) 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 User-Agent: G2/1.0 MIME-Version: 1.0 Message-ID: <4db43571-7f86-4e73-8849-c41160927703@googlegroups.com> Subject: Extending a third party tagged type while adding finalization From: Jere Injection-Date: Wed, 22 Nov 2017 12:43:41 +0000 Content-Type: text/plain; charset="UTF-8" Xref: feeder.eternal-september.org comp.lang.ada:49052 Date: 2017-11-22T04:43:41-08:00 List-Id: Has anyone have any good tips for extending a third party type: type Third_Party_Type is tagged private; I want to extend it but also add finalization which is inheritable by later descendants: type My_Base_Type is new Third_Party_Type with private; procedure Finalize(Object : in out My_Type); procedure Initialize(Object : in out My_Type); procedure Adjust(Object : in out My_Type); That way, clients of My_Base_Type can use them along side Third_Party_Type such as through a variable of Third_Party_Type'Class. My first (untested) thought is to maybe string together a proxy object inside My_Base_Type using the Rosen technique and have it forward the Finalization operations through dispatch. I haven't tested this to see if it works but even if it does, it feels very hacky and is not my preferred way. Does anyone have any techniques they have used in the past?