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=-0.3 required=5.0 tests=BAYES_00, REPLYTO_WITHOUT_TO_CC autolearn=no autolearn_force=no version=3.4.4 Path: border2.nntp.dca.giganews.com!nntp.giganews.com!goblin3!goblin2!goblin.stu.neva.ru!aioe.org!.POSTED!not-for-mail From: "Dmitry A. Kazakov" Newsgroups: comp.lang.ada Subject: Re: Redispatching Date: Thu, 17 Apr 2014 09:26:02 +0200 Organization: cbb software GmbH Message-ID: References: <7f1c01c5-3563-4b94-9831-152dbbf2ecdc@googlegroups.com> <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> Reply-To: mailbox@dmitry-kazakov.de NNTP-Posting-Host: G+aXx1XI67D34t54ibhUPQ.user.speranza.aioe.org Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit X-Complaints-To: abuse@aioe.org User-Agent: 40tude_Dialog/2.0.15.1 X-Notice: Filtered by postfilter v. 0.8.2 Xref: number.nntp.dca.giganews.com comp.lang.ada:185780 Date: 2014-04-17T09:26:02+02:00 List-Id: On Wed, 16 Apr 2014 22:53:28 +0300, Niklas Holsti wrote: > On 14-04-16 12:30 , J-P. Rosen wrote: >> As far as redispatching is concerned: since a method is linked to a >> single class, there should be no redispatching. > > (I think you meant to write "linked to a single type", not "class".) > > Then you must also be of the opionion that there should be no > inheritance of methods, because inheritance makes the same method become > linked to different types. Is that your view? It is confused. A primitive operation (method) is defined on (linked to) the whole class T'Class. Its specific body is defined on a specific type S<:T. Re-dispatch does not violate the contract of the primitive operation, it potentially does the contract of the *type-specific* body where re-dispatch happens. BTW, it is not just re-dispatch. I would argue that when you call a parent's implementation from the body you also potentially violate the contract: procedure F (X : in out S) is begin ... F (T (X)); -- Parent's implementation ... end F; Of course here potential harm is much lesser than in the case of re-dispatch. In short, we know that type coercion is bad, don't we? -- Regards, Dmitry A. Kazakov http://www.dmitry-kazakov.de