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=ham autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,56131a5c3acc678e X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2003-12-08 07:00:59 PST Path: archiver1.google.com!news2.google.com!fu-berlin.de!uni-berlin.de!tar-atanamir.cbb-automation.DE!not-for-mail From: Dmitry A. Kazakov Newsgroups: comp.lang.ada Subject: Re: Question about OO programming in Ada Date: Mon, 08 Dec 2003 16:05:16 +0100 Message-ID: References: <5JmdnUF_9o_ABE-iRTvUrg@rapidnet.com> <1273941.m4G3ZzughP@linux1.krischik.com> <1070889942.156714@master.nyc.kbcfp.com> NNTP-Posting-Host: tar-atanamir.cbb-automation.de (212.79.194.116) Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Trace: news.uni-berlin.de 1070895658 75549186 212.79.194.116 ([77047]) X-Newsreader: Forte Agent 1.8/32.548 Xref: archiver1.google.com comp.lang.ada:3228 Date: 2003-12-08T16:05:16+01:00 List-Id: On Mon, 08 Dec 2003 08:25:42 -0500, Hyman Rosen wrote: >Dmitry A. Kazakov wrote: >> C++ does not distinguish class-wide and specific types. > >C++ has no concept of a classwide type as such, >and certainly does not support having objects of >classwide type, that much is true. Surely it has. No dispatch is possible on specific types. This fact is language independent. >> The same object is treated as a class-wide or specific > > depending on the run-time call context. > >Objects declared as a certain type are always treated as >that specific type. Pointers and references to classes are >treated as potential pointers to some derived class. But I >don't think that's what you mean. > >> class X >> { >> public : >> virtual void Foo (); >> virtual void Baz () { Foo (); } >> ... >> >> Is the call to Foo from Baz dispatching? The answer is, well, >> sometimes it will. > > [*] "this" is a class-wide pointer when Baz was not directly or > > indirectly called from a constructor/destructor. It is a specific > > pointer otherwise. > >No, that is incorrect, showing the level-one misunderstanding of >how this works. (Level-zero is to fail to realize that there's >anything special about this case.) > >The call to Foo from Baz is always dispatching, regardless of >whether Baz is called from a *tor or from somewhere else. It is >the dispatch table (or whatever equivalent mechanism the compiler >might use) which changes during *tor execution. [..] The implementation mechanism is irrelevant. Whether given compiler forges the dispatching table to achieve the effect of making a dispatching method non-dispatching or "dispatching" as if it were non-dispatching or whatever you would call it, is no matter. The fact is, the same method sometimes appears dispatching and sometimes not. >> Arguably C++ is not strongly typed because no type could be addressed > > to implicit "this" in Baz, and so to the actual type. > >The type of "this" in Baz is (always) pointer-to-X. See above >> In Ada one can always statically determine whether a call is >> dispatching. > >In C++ as well. See above -- Regards, Dmitry Kazakov http://www.dmitry-kazakov.de