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=ham autolearn_force=no version=3.4.4 X-Google-Thread: a07f3367d7,7ff1de84a8945e80 X-Google-Attributes: gida07f3367d7,public,usenet X-Google-NewGroupId: yes X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news2.google.com!news4.google.com!proxad.net!feeder1-2.proxad.net!usenet-fr.net!de-l.enfer-du-nord.net!news.weisnix.org!citadel.nobulus.com!fi.sn.net!newsfeed1.tdcnet.fi!news.song.fi!not-for-mail Date: Thu, 13 Aug 2009 23:13:39 +0300 From: Niklas Holsti Organization: Tidorum Ltd User-Agent: Mozilla-Thunderbird 2.0.0.22 (X11/20090706) MIME-Version: 1.0 Newsgroups: comp.lang.ada Subject: Re: Access types as parameters References: <521c4843-d40f-4545-9e80-ca725e847090@h21g2000yqa.googlegroups.com> <8410fc60-9b8a-4f82-92fc-622a6bbe5931@i18g2000pro.googlegroups.com> <8880c3d0-a07f-4d4e-ac87-372014598576@d15g2000prc.googlegroups.com> <4a83d018$0$26303$4f793bc4@news.tdc.fi> In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Message-ID: <4a847400$0$26304$4f793bc4@news.tdc.fi> NNTP-Posting-Host: 81.17.205.61 X-Trace: 1250194432 news.tdc.fi 26304 81.17.205.61:43086 X-Complaints-To: abuse@tdcnet.fi Xref: g2news2.google.com comp.lang.ada:7744 Date: 2009-08-13T23:13:39+03:00 List-Id: Dmitry A. Kazakov wrote: > On Thu, 13 Aug 2009 11:34:20 +0300, Niklas Holsti wrote: > >> Randy Brukardt wrote: >> >>> You almost never want redispatching >> That's interesting as my experience is the opposite: Most of the calls >> between primitive methods in my code use redispatching. > > Shudder... Also an interesting reaction. > I consider re-dispatch is an indication of a language / design problem, > because it is a hidden type error. An argument goes as follows. Once you > have dispatched to some type T, the corresponding controlling parameter is > of this type. Let we converted it to a class. If now it dispatches again to > T, then that was just wasting time, if it dispatches to S /= T then it is a > type error. To me that is a very abstract and formalistic argument that is easily weaker than the practical benefits (providing sensible but overridable default behaviour while avoding code duplication) that make me use redispatching. What is more, a central benefit of inheritance is that an object can be viewed as being of parent type T *and also* of derived type S, depending on the context and your needs, so I don't accept that redispatching "to a different type" implies a type error. -- Niklas Holsti Tidorum Ltd niklas holsti tidorum fi . @ .