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.stack.nl!reality.xs3.de!news.jacob-sparre.dk!loke.jacob-sparre.dk!pnx.dk!.POSTED!not-for-mail From: "Randy Brukardt" Newsgroups: comp.lang.ada Subject: Re: Your wish list for Ada 202X Date: Mon, 14 Apr 2014 19:08:48 -0500 Organization: Jacob Sparre Andersen Research & Innovation 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> NNTP-Posting-Host: static-69-95-181-76.mad.choiceone.net X-Trace: loke.gir.dk 1397520530 6931 69.95.181.76 (15 Apr 2014 00:08:50 GMT) X-Complaints-To: news@jacob-sparre.dk NNTP-Posting-Date: Tue, 15 Apr 2014 00:08:50 +0000 (UTC) X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2900.5931 X-RFC2646: Format=Flowed; Original X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.6157 Xref: news.eternal-september.org comp.lang.ada:19302 Date: 2014-04-14T19:08:48-05:00 List-Id: "Niklas Holsti" wrote in message news:br07nkFnvrbU1@mid.individual.net... ... > (This is why I don't understand your and Randy's abhorrence of > re-dispatching -- to me, there is no basic difference between > dispatching calls in class-wide operations, and re-dispatching calls in > primitive operations.) I don't think it is a good idea to assume that Dmitry and I have the same opinion on anything, even if the result appears to be the same. :-) I view dispatching operations as the low-level primitives of a type, while class-wide operations (which actually involve dispatching) as higher-level operations of the type. As such, a re-dispatching call means that there is some sort of abstraction inversion going on, and that's usually (but not always) bad. Dispatching operations necessarily have weaker contracts than statically bound calls, and that is especially important for "contracts" that can't be described in Ada and thus can't be checked (either statically or dynamically). After all, most extensions are created by someone other than the originator of the original class, so violations of those implicit contracts are bound to happen. (Errors happen any time humans are involved!) Thus, you have much more confidence in operations that don't involve re-dispatching -- as a practical matter, it is a lot easier to debug statically bound calls rather than dispatching ones. Finally (really a restating of the last point), I find that it's fairly easy to ensure that all of the primitive operations of a particular type have the same world-view. That's not as true when some of the operations are assuming the object is of type T, and some are re-dispatching to some TT derived from T -- I've found many instances where some predicate of TT gets a different answer than the same predicate of the same object viewed as a T. That sort of things leads to all kinds of bugs, because not all of those predicates are explicit in the code (even as statically bound calls). This last issue doesn't arise for a class-wide operation, where every call is going to look at an object of TT as type TT. And that's really the major difference between "dispatching" and "re-dispatching". Perhaps I'm just being too conservative here, but I do like being able to get things to work as expected. Randy.