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-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,56131a5c3acc678e X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2003-12-08 10:00:20 PST Path: archiver1.google.com!news2.google.com!newsfeed2.dallas1.level3.net!news.level3.com!crtntx1-snh1.gtei.net!news.gtei.net!newsfeed1.easynews.com!easynews.com!easynews!small1.nntp.aus1.giganews.com!border1.nntp.aus1.giganews.com!intern1.nntp.aus1.giganews.com!nntp.giganews.com!nntp.rapidnet.com!news.rapidnet.com.POSTED!not-for-mail NNTP-Posting-Date: Mon, 08 Dec 2003 12:00:18 -0600 Date: Mon, 08 Dec 2003 11:55:02 -0600 From: Chad Bremmon Reply-To: bremmon@acm.org User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.4) Gecko/20030624 Netscape/7.1 (ax) X-Accept-Language: en-us, en MIME-Version: 1.0 Newsgroups: comp.lang.ada Subject: Re: Question about OO programming in Ada References: <5JmdnUF_9o_ABE-iRTvUrg@rapidnet.com> <1273941.m4G3ZzughP@linux1.krischik.com> In-Reply-To: Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit Message-ID: NNTP-Posting-Host: 12.13.119.27 X-Trace: sv3-fw3jgVeH17Muok/8Bb+SDmRoZG9jZUEPgamFYUcQ36G/xjkoe0RavBOWoA1gTty+8bnWoHJx9VltcQO!0ReloJEkoruy0ce2H16wIGboa3ep+FzO5vkj0QjXxVgi7iJ9RQiZvcNyc/eiKM8/o7EzsCZ5IfC+ X-Complaints-To: abuse@rapidnet.com X-DMCA-Complaints-To: abuse@rapidnet.com X-Abuse-and-DMCA-Info: Please be sure to forward a copy of ALL headers X-Abuse-and-DMCA-Info: Otherwise we will be unable to process your complaint properly X-Postfilter: 1.1 Xref: archiver1.google.com comp.lang.ada:3230 Date: 2003-12-08T11:55:02-06:00 List-Id: Dmitry A. Kazakov wrote: > On Mon, 08 Dec 2003 08:42:28 GMT, Hyman Rosen > wrote: > > >>Chad Bremmon wrote: > > >>>Because Ada 95 is strongly typed, the compiler can figure out at compile >>>time which function to call, based on the type. This ensures that >>>dispatching is done during compile time. You still have the look and >>>feel of polymorphism, without the non-deterministic nature of runtime >>>dispatching. >> >>What makes you think that C++ is any different in this regard? > > > C++ does not distinguish class-wide and specific types. The same > object is treated as a class-wide or specific depending on the > run-time call context. For example: > > 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. Arguably C++ is not strongly typed because no type > could be addressed to implicit "this" in Baz, and so to the actual > type [*). This function would NEVER dispatch in Ada95. Unless the parameter to a class is of a Tagged_Type'Class, there is no possibility for dynamic runtime dispatcing, period. End of story. You can't get there! If you still disagree, code it up and show it to me! Even if you use the TaggedType'Class as a parameter to a primitive operation, the compiler will do it's damndest to get the dispatching figured out at compile time. The above C++ code snipped shows my point. In C++ you can NEVER know if the compiler is going to throw in a dispatching table and another level of non-deterministic indirection waiting to get that function called. > > In Ada one can always statically determine whether a call is > dispatching. Unfortunately, this advantage remains largely unused > because of redispatching support and embedded tags. > > ------- > [*] "this" is a class-wide pointer when Baz was not directly or > indirectly called from a constructor/destructor. It is a specific > pointer otherwise. > > -- > Regards, > Dmitry Kazakov > http://www.dmitry-kazakov.de