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!.POSTED!not-for-mail From: Ivan Levashev Newsgroups: comp.lang.ada Subject: Re: Smart Pointers and Tagged Type Hierarchies Date: Thu, 27 Jul 2017 00:53:01 +0700 Organization: A noiseless patient Spider Message-ID: References: <2017072417413775878-contact@flyx.org> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit Injection-Date: Wed, 26 Jul 2017 17:54:50 -0000 (UTC) Injection-Info: mx02.eternal-september.org; posting-host="4abe5f6c6c5a12a33766ee0da600ba0a"; logging-data="18319"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+Ojga5wXpdf4GeqpbPxo2xI64aqnqi6s4=" User-Agent: Mozilla/5.0 (Windows NT 5.2; WOW64; rv:31.0) Gecko/20100101 Thunderbird/31.8.0 In-Reply-To: <2017072417413775878-contact@flyx.org> Cancel-Lock: sha1:19cdRJ+E8JbKrmPvPFCpV3neNYg= Xref: news.eternal-september.org comp.lang.ada:47515 Date: 2017-07-27T00:53:01+07:00 List-Id: 24.07.2017 22:41, Felix Krause пишет: > * A derived type, if it wants to provide additional operations (like > Current_Position), must not only derive from Instance, but also from > Reference, to be able to provide an type-safe interface to those > operations. My approach is to have independent (mutually noncastable) reference types and explicit upcast/downcast functions. You can either copy all parent's methods by hand or use generic mix-ins to add methods to proto-reference-types for every reference type. Also, tricks with Ada 2012 references can save Adjust/Finally calls. As soon as references don't have dispatching, tag is useless, so it can overlap with Ada 2012 reference's access discriminant. Best Regards, Ivan Levashev, Barnaul -- If you want to get to the top, you have to start at the bottom