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!news.eternal-september.org!feeder.eternal-september.org!news.swapon.de!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail From: Niklas Holsti Newsgroups: comp.lang.ada Subject: Re: Your wish list for Ada 202X Date: Wed, 16 Apr 2014 09:32:15 +0300 Organization: Tidorum Ltd Message-ID: References: <7f1c01c5-3563-4b94-9831-152dbbf2ecdc@googlegroups.com> <8bhozh836pyt$.1qctlysud0s2q$.dlg@40tude.net> <1cdsyxjzsfgzm.1synpaujysv21$.dlg@40tude.net> <1aa804jg9qq4o$.wdiq33yo621l.dlg@40tude.net> <1w6eh0aiksmdh$.1h16p7y0b8c6h.dlg@40tude.net> <17twpp4p8u7o$.1idvzaaio4f3t$.dlg@40tude.net> <1wjmcbk375lzk.6o7dpqcp3va3.dlg@40tude.net> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-Trace: individual.net POp9+E3wYprFCSJqeODySAvOtmiwwUXOwjqAWsE+TPc1FANGn0 Cancel-Lock: sha1:qCNC/4pZYs7Jfn/s9QrkrCm95o8= User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.8; rv:24.0) Gecko/20100101 Thunderbird/24.4.0 In-Reply-To: Xref: news.eternal-september.org comp.lang.ada:19328 Date: 2014-04-16T09:32:15+03:00 List-Id: On 14-04-15 10:21 , Natasha Kerensikova wrote: > Hello, [snip] > let's consider an abstract type T, with an abstract operation AO and a > huge part of the algorithm implemented in primitive operations for T, > making use of AO. Concrete descendants of T are supposed to implement > AO, and inherit the rest without overriding. > > Then in T subprograms I end up with things that look like: > AO (T'Class (Self), Other, Arguments); > > > I've always thought of this as "re-disatching". Is it? Yes, as I understand the word. > Are there better language facilities to use in such situations? If, as you say above, descendants of T are supposed to inherit the primitive operations of T *without overriding them*, you could implement those primitive operations instead as class-wide operations (operations on T'Class), and then calls of AO from those class-wide operations would be (simply) dispatching, and not re-dispatching. As I understand them, both Dmitry and Randy would consider the class-wide form a better solution, but it works only if you never need to override these class-wide operations for any descendant types. I am seldom sure about that (never needing to override, not even in the future), so I prefer to have the operations as primitive rather than class-wide, and consequently to use re-dispatch. -- Niklas Holsti Tidorum Ltd niklas holsti tidorum fi . @ .