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,FREEMAIL_FROM autolearn=ham autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,436e4ce138981b82 X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2004-03-10 05:09:13 PST Path: archiver1.google.com!news2.google.com!newsfeed2.dallas1.level3.net!news.level3.com!news-out.visi.com!petbe.visi.com!news.octanews.net!ash.uu.net!spool.news.uu.net!not-for-mail Date: Wed, 10 Mar 2004 08:08:56 -0500 From: Hyman Rosen User-Agent: Mozilla Thunderbird 0.5 (Windows/20040207) X-Accept-Language: en-us, en MIME-Version: 1.0 Newsgroups: comp.lang.ada Subject: Re: abstract sub programs overriding References: <1078776213.376775@master.nyc.kbcfp.com> <1078839257.157439@master.nyc.kbcfp.com> <5cmr40t76va200betf07b7bd6er05ltto9@4ax.com> <1078845298.702789@master.nyc.kbcfp.com> <0ipr40thtf86b520a0qdi003aj87gtuhd4@4ax.com> <1078849973.701176@master.nyc.kbcfp.com> In-Reply-To: Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit Organization: KBC Financial Products Message-ID: <1078924150.268074@master.nyc.kbcfp.com> Cache-Post-Path: master.nyc.kbcfp.com!unknown@aphelion.nyc.kbcfp.com X-Cache: nntpcache 3.0.1 (see http://www.nntpcache.org/) NNTP-Posting-Host: 204.253.250.10 X-Trace: 1078924150 23879 204.253.250.10 Xref: archiver1.google.com comp.lang.ada:6209 Date: 2004-03-10T08:08:56-05:00 List-Id: Dmitry A. Kazakov wrote: > To allow /= to force. To re-dispatch in Ada you have do it expilictly > by converting the object of a specific type to a class-wide. This is > way different (though also problematic) from inconsistent attempts in > C++ to view the same thing as both specific and class-wide. This > cannot be reconciled. In C++ you can also choose whether to dispatch or not, but the default is to dispatch. If you want to call a function of a particular class, you just specify that (eg., Mumble::Foo()) and you get it. Remember, Ada compilers still use a vtable pointer inside each object, not the way you would have it, a two-part object/vtable fat pointer. > Huh. So the common point of view is that dispatching on unconstructed > objects is good? As I said, not in C++. But much fuss has been made of claiming that C++'s way of dispatching in *tors is "confusing" and there are also people who want constructors to be able to easily condition their behavior based on the complete type of the object. So Java, and Ada too, I suppose, do a two-step initialization. The bits of the object are perhaps set to something marginally non-random (in Java it's all bits zero; you describe what Ada does below) and then methods are on their own to worry about whether things are ready to be used. > Note also that in Ada it cannot happen. Really? What if you have a hierarchical class where each base has its own Initialize? Is each version responsible for calling the version of its base? What is to keep a base version from converting to classwide type and calling a dispatching method which will try to use an unset member of the derived class (eg., a file not yet opened)?