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!feeder.eternal-september.org!news.unit0.net!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail From: Niklas Holsti Newsgroups: comp.lang.ada Subject: Re: Ada Annoyances Date: Thu, 22 Jun 2017 22:22:10 +0300 Organization: Tidorum Ltd Message-ID: References: <1ac5a44b-4423-443a-a7bb-2864d9abe78f@googlegroups.com> <1498048151.20885.28.camel@obry.net> <96174ea5-852d-44e9-8535-7c1eb24d5326@googlegroups.com> <98b98b8b-2f56-4d14-9989-3df51b08d97e@googlegroups.com> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit X-Trace: individual.net DRkpNMykr6R7Nqq0ttC7yQ5Wv0aQm0xuaEWqkwxd0pOlQ6ZDRA Cancel-Lock: sha1:kHgduG3KDScnvW4DpZZoqBkY/7I= User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.8; rv:45.0) Gecko/20100101 Thunderbird/45.8.0 In-Reply-To: Xref: news.eternal-september.org comp.lang.ada:47059 Date: 2017-06-22T22:22:10+03:00 List-Id: On 17-06-22 16:30 , Dmitry A. Kazakov wrote: > On 22/06/2017 12:29, pythoner6@gmail.com wrote: > >> What do you mean by "re-dispatch" here? How is it different from the >> dynamic dispatch that happens in Ada with class-wide types? > > Re-dispatch is dynamic dispatch when you go through the same virtual > table twice. I think that is inaccurate, unless you have a different definition of "re-dispatch" from what I remember of discussions re this topic. Consider: type Parent is tagged record .... end record; procedure Foo (P : Parent); procedure Bar (P : Parent); type Child is new Parent with record ... end record; -- Child inherits Foo from Parent. overriding procedure Bar (C : Child); followed by C : Child; Foo (C); That call is not dispatching, so it does not go through the "virtual table". It calls the inherited Foo for Child. Now suppose Foo (P : Parent) does a (re-) dispatching call to Bar, which in this example calls the overriding Bar (C : Child): procedure Foo (P : Parent) is begin Bar (Parent'Class (P)); end Foo; I believe this call of Bar is considered "re-dispatching", because there is a conversion from Parent to Parent'Class (effectively, Child). But there is only one use of the "virtual table". > Since you are already there = you have determined the > actual specific type, it does not make sense (and dangerous) to do this > again. > > (I know that there are software patterns based on re-dispatch, they all > are wrong.) As you have often said. I still disagree. Just to let the OP know that opinions differ on this topic. -- Niklas Holsti Tidorum Ltd niklas holsti tidorum fi . @ .