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 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!news3.google.com!feeder.news-service.com!de-l.enfer-du-nord.net!news.weisnix.org!newsfeed.ision.net!newsfeed2.easynews.net!ision!newsfeed.arcor.de!newsspool2.arcor-online.net!news.arcor.de.POSTED!not-for-mail From: "Dmitry A. Kazakov" Subject: Re: Access types as parameters Newsgroups: comp.lang.ada User-Agent: 40tude_Dialog/2.0.15.1 MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Reply-To: mailbox@dmitry-kazakov.de Organization: cbb software GmbH 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> Date: Thu, 13 Aug 2009 11:15:43 +0200 Message-ID: NNTP-Posting-Date: 13 Aug 2009 11:15:43 CEST NNTP-Posting-Host: 36502947.newsspool4.arcor-online.net X-Trace: DXC=4kdbFKg=jJkPKPPVf;4hUj4IUKkgbbWG^HbF98@l X-Complaints-To: usenet-abuse@arcor.de Xref: g2news2.google.com comp.lang.ada:7716 Date: 2009-08-13T11:15:43+02:00 List-Id: 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... > My tagged types tend to have a hierarchy of primitive operations, for > example an Overall_Method that implements some functionality by a > sequence of calls to a Detail_Method. Some derived types override > Detail_Method, so the call from Overall_Method to Detail_Method must > redispatch. Some other (or the same) derived types override > Overall_Method, so it cannot be class-wide. When this happens to me I always consider it as a strong indication to re-design. > Perhaps the frequency of redispatching depends on the application > domain, or on personal programming style. The frequency of redispatching > might me an interesting OO "metric". Yes. I think the target shall be strictly 0%. 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. -- Regards, Dmitry A. Kazakov http://www.dmitry-kazakov.de