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: border2.nntp.dca3.giganews.com!backlog4.nntp.dca3.giganews.com!border1.nntp.dca.giganews.com!nntp.giganews.com!usenet.blueworldhosting.com!feeder01.blueworldhosting.com!feeder.erje.net!eu.feeder.erje.net!xlned.com!feeder5.xlned.com!newsfeed.xs4all.nl!newsfeed2.news.xs4all.nl!xs4all!news.stack.nl!aioe.org!.POSTED!not-for-mail From: "Dmitry A. Kazakov" Newsgroups: comp.lang.ada Subject: Re: Redispatching Date: Fri, 18 Apr 2014 22:51:30 +0200 Organization: cbb software GmbH Message-ID: <8079p8bcukba.za9f3g3z0426$.dlg@40tude.net> References: <7f1c01c5-3563-4b94-9831-152dbbf2ecdc@googlegroups.com> <1aa804jg9qq4o$.wdiq33yo621l.dlg@40tude.net> <1w6eh0aiksmdh$.1h16p7y0b8c6h.dlg@40tude.net> <17twpp4p8u7o$.1idvzaaio4f3t$.dlg@40tude.net> <1wjmcbk375lzk.6o7dpqcp3va3.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 X-Original-Bytes: 3487 Xref: number.nntp.dca.giganews.com comp.lang.ada:185822 Date: 2014-04-18T22:51:30+02:00 List-Id: On Fri, 18 Apr 2014 23:08:25 +0300, Niklas Holsti wrote: > On 14-04-17 10:26 , Dmitry A. Kazakov wrote: >> On Wed, 16 Apr 2014 22:53:28 +0300, Niklas Holsti wrote: >> >>> On 14-04-16 12:30 , J-P. Rosen wrote: >>>> As far as redispatching is concerned: since a method is linked to a >>>> single class, there should be no redispatching. >>> >>> (I think you meant to write "linked to a single type", not "class".) >>> >>> Then you must also be of the opionion that there should be no >>> inheritance of methods, because inheritance makes the same method become >>> linked to different types. Is that your view? >> >> It is confused. A primitive operation (method) is defined on (linked to) >> the whole class T'Class. Its specific body is defined on a specific type >> S<:T. > > As you see it, yes. However, in Ada the parameters of type T are really > views of objects which may be of type T or of a type derived from T. Wrong. Consider this set of declarations: type T is ...; procedure Bar (X : T); type S is new T ...; procedure Foo (X : S); Now the following is illegal: procedure Bar (X : T) is begin X.Foo; -- Compile error end Bar; X in Bar is of the type T and of no other type. You can convert X using so-called "view-conversion" to an object of another type, e.g. S or T'Class. This conversion is a type conversion. Yes, it has certain properties when X is tagged (and thus by-reference), such as reusing the old object for the new one. These properties are irrelevant to the type semantics though. You get an object of a different type. If Ada supported classes of by-copy types, then conversion to S or T'Class would produce a new object. But the type semantics would remain same. -- Regards, Dmitry A. Kazakov http://www.dmitry-kazakov.de