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: 103376,2ff5c149712ec0eb X-Google-Attributes: gid103376,public,usenet X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news1.google.com!news1.google.com!border1.nntp.dca.giganews.com!nntp.giganews.com!newsfeed00.sul.t-online.de!t-online.de!storethat.news.telefonica.de!telefonica.de!newsfeed.arcor.de!newsspool3.arcor-online.net!news.arcor.de.POSTED!not-for-mail From: "Dmitry A. Kazakov" Subject: Re: Ada Interfaces and the Liskov Substitution Principle 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: <1p717twnydnre$.1j6izygvqo832.dlg@40tude.net> <1180425803.422075.100090@o5g2000hsb.googlegroups.com> <1180452858.118039.67740@w5g2000hsg.googlegroups.com> <1180510814.812025.251580@u30g2000hsc.googlegroups.com> <1180529642.741098.224230@q66g2000hsg.googlegroups.com> <1ljmbgesxien.syhurcvjdcd2$.dlg@40tude.net> <1180558336.041236.211560@p77g2000hsh.googlegroups.com> <1j91i6rk18kqd.4zjp36eyvps3.dlg@40tude.net> <1180619211.595952.116690@k79g2000hse.googlegroups.com> <1180704750.516171.126220@h2g2000hsg.googlegroups.com> <1r1lyrsyvr52v$.vx1t785sxb9u.dlg@40tude.net> <1180729864.936057.258970@p47g2000hsd.googlegroups.com> <1180802978.626766.128330@h2g2000hsg.googlegroups.com> Date: Sun, 3 Jun 2007 09:09:12 +0200 Message-ID: <2vwm0plnu7gn.172jlansis6fm.dlg@40tude.net> NNTP-Posting-Date: 03 Jun 2007 09:09:06 CEST NNTP-Posting-Host: ac899bc7.newsspool4.arcor-online.net X-Trace: DXC=Y9@=bROjkaT\9P[:DUn00Q4IUK On Sat, 02 Jun 2007 09:49:38 -0700, Maciej Sobczak wrote: > On 2 Cze, 10:19, "Dmitry A. Kazakov" > wrote: > >>> The difference is that (in Ada terms) replacement >>> allows you to change the tag. Assignment cannot do this. >> >> Neither can. > > Yes, replacement can change the tag. It's the tag of referred object > that can change. An access variable can point to Circle and then to > Triangle. No, this is illegal. At least in Ada,: access Circle and access Triangle are different types. They cannot be assigned to each other. > I can also replace a wheel in my car but it's not assignment of > wheels. If you want to bring the issue of identity (the wheel) then that's again subject shifting. >>>> Ah, wouldn't replacement double dispatching? >> >>> No, it wouldn't and that's the second difference. Replacement just >>> gets rid of the current value before the new value is refered to, >>> which means that from the dispatching point of view this operation is >>> simply linear on right-hand-side - it's a pure single dispatch. >> >> No, this does not work. Apart from being semantically wrong in general >> case, it is technically wrong. > > Why is it semantically wrong? Because variables of T'Class can be assigned with the values of T'Class if T has assignment. > Consider replacing wheels in your car. You should have annotated that example with types, values and variables. >> You have to dispatch to finalize LHS. You >> have to dispatch to re-construct it from RHS. > > It doesn't change anything in my reasoning. Two linear dispatches > don't magically give you double dispatch! Of course it does. A function of two arguments is still a function of two arguments. Decomposability of the function into a product is irrelevant to the issue. It dispatches in both arguments. >>> Assignment has to be '2D' with both axes, or O(n2) in terms of >>> implementation complexity. It has to be double-dispatching to make any >>> sense and this is unrealistic implementation-wise. >> >> It is semantically this way. There is nothing to do about it, but to scrap >> either assignment or class. (We are going in circles) > > That's exactly what I'm talking about from the very beginning - > T'Class should be limited. > Is it only my impression that we actually agree? :-) Not at all. The point is: limited T <=> limited T'Class No more, no less. > I'm talking about replacing wheels in my car. Twice a year I *replace* > summer wheels for winter ones and the other way round. I *don't > assign* them. If you mean assignment of pointers, then pointers are typed in Ada. If the pointers here have the same type (like P is access Wheel'Class) then there is nothing to talk about. You assign P to P. That is just irrelevant to the problem at hand. The issue is about assigning *different* types from a class, like ones from Wheel'Class (Goodyear, Michelin), or like ones from (access Wheel)'Class. Note brackets! The latter is illegal in Ada, but if it were legal, you'd have exactly the same thing. >> Then >> because your types algebra has classes one could create a class of. In the >> end you will face the same question again: what is the assignment on the >> class. All this referential stuff is just shifting subjects. > > No, it's not shifting subjects. Of course it is, because the types are same. The issue of identity / references you are trying to bring in is irrelevant. Multiple dispatch assignment is fully applicable to wheel and car objects. When you "replace" wheels, you could perform different tasks depending on the types of the old and new wheels .How these tasks can be encapsulated into one replacement action? -- Regards, Dmitry A. Kazakov http://www.dmitry-kazakov.de