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: 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!aioe.org!.POSTED!not-for-mail From: "Dmitry A. Kazakov" Newsgroups: comp.lang.ada Subject: Re: Your wish list for Ada 202X Date: Sat, 19 Apr 2014 16:21:40 +0200 Organization: cbb software GmbH Message-ID: References: <7f1c01c5-3563-4b94-9831-152dbbf2ecdc@googlegroups.com> <1w6eh0aiksmdh$.1h16p7y0b8c6h.dlg@40tude.net> <17twpp4p8u7o$.1idvzaaio4f3t$.dlg@40tude.net> <1wjmcbk375lzk.6o7dpqcp3va3.dlg@40tude.net> <1kwpgk4mrnzey.18388dob823vp$.dlg@40tude.net> <129pvrzqrv83p$.orkstybnskgo.dlg@40tude.net> <9b0anu6u678j.kfliatroezt0$.dlg@40tude.net> <1jfeyy5n6yetv$.1hdnb6kf3tnj2$.dlg@40tude.net> Reply-To: mailbox@dmitry-kazakov.de NNTP-Posting-Host: AuYlnUSfTZrfhAkRjyySpQ.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: news.eternal-september.org comp.lang.ada:19417 Date: 2014-04-19T16:21:40+02:00 List-Id: On Sat, 19 Apr 2014 16:53:47 +0300, Niklas Holsti wrote: > On 14-04-19 13:06 , Dmitry A. Kazakov wrote: >> On Sat, 19 Apr 2014 12:08:19 +0300, Niklas Holsti wrote: >> >>> On 14-04-19 11:39 , Dmitry A. Kazakov wrote: >>>> On Sat, 19 Apr 2014 10:19:02 +0200, Dmitry A. Kazakov wrote: >>>> >>>>> "Re-" presumes that dispatch happens again. What is in common to these two >>>>> instances of dispatch what makes it re-dispatch? It is 1) the same >>>>> polymorphic operation and 2) the same object. Take either away and it is >>>>> not re-dispatch anymore: >>>>> >>>>> 1. Different operations: >>>>> >>>>> X.Foo; >>>>> X.Bar; -- This is not re-dispatch! >>>>> >>>>> 2. Different objects: >>>>> >>>>> X.Foo; >>>>> Y.Foo; -- This is not re-dispatch! >>>> >>>> After some consideration, I take the position 1 back. Operation can be >>>> different. But the object must be same. >>> >>> If we are talking about by-copy types, then whether X and Y are the >>> "same object" is fuzzy. Is a copy the same object as the original? >> >> A copy is another object. > > Then (by your definitions) redispatching is never possible based on > by-copy parameters, because (in your definition) redispatching only > occurs if the first and second dispatching call use the same object, but > the pass-by-copy in the first dispatching call (in your view) creates a > new object which is then used in the second dispatching call. > > That is a consistent view (good for you) but it disagrees with my memory > of your earlier arguments against redispatching, which were based more > on the logical redundancy of two successive dispatching calls on the > same tag. Why does it disagree? There is no contradiction between A) re-dispatch is impossible with by-copy semantics, and B) when re-dispatch is possible then from the SW design POV, it is redundant, abstraction inversion, weak typing, inefficient, LSP violation, maintenance headache, you name it. Arguably, if re-dispatch is impossible for by-copy types when it should be made unavailable for by-reference types as well. Finally, it was not necessary to introduce view conversions in Ada for the purpose of re-dispatch, because the desired effect were achievable through the Rosen's trick: type T is ... Self : not null access T'Class := T'Unchecked_Access; end record; procedure Foo (X : T) is begin X.Self.Bar; -- I know what I am doing end Foo; Using Self is more visible as dangerous than view conversion, IMO. -- Regards, Dmitry A. Kazakov http://www.dmitry-kazakov.de