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!news.eternal-september.org!feeder.eternal-september.org!nntp-feed.chiark.greenend.org.uk!ewrotcd!newsfeed.xs3.de!io.xs3.de!news.jacob-sparre.dk!franka.jacob-sparre.dk!pnx.dk!.POSTED.rrsoftware.com!not-for-mail From: "Randy Brukardt" Newsgroups: comp.lang.ada Subject: Re: Smart Pointers and Tagged Type Hierarchies Date: Mon, 31 Jul 2017 22:43:37 -0500 Organization: JSA Research & Innovation Message-ID: References: <2017072417413775878-contact@flyx.org> Injection-Date: Tue, 1 Aug 2017 03:43:38 -0000 (UTC) Injection-Info: franka.jacob-sparre.dk; posting-host="rrsoftware.com:24.196.82.226"; logging-data="29516"; mail-complaints-to="news@jacob-sparre.dk" X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2900.5931 X-RFC2646: Format=Flowed; Response X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.7246 Xref: news.eternal-september.org comp.lang.ada:47536 Date: 2017-07-31T22:43:37-05:00 List-Id: "Felix Krause" wrote in message news:2017072417413775878-contact@flyx.org... ... > A problem I encounter is how this can be used with type hierarchies i.e. I > have a smart pointer managing a tagged type, and I want to be able to > derive from that tagged type and still be able to use my smart pointer > with that new type. What's needed is something like "co-derivation", where multiple types are derived in lock-step. Sadly, this is effectively impossible in an OOP environment, because dispatching calls would have the wrong parameter types for any co-derived types. (I've spent quite a bit of effort in trying to make such a solution work, and have enlisted others to help, but the conclusion was that it wasn't promising.) One would have to have some form of multiple dispatch to get around that, but that's a bridge too far for a language that's mainly used in embedded, safety-critical systems. One could make it work for non-tagged types, but of course that prevents dispatching and extension. So it's probably not worth the effort to design. Randy.