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,436e4ce138981b82 X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2004-03-09 07:45:36 PST Path: archiver1.google.com!news2.google.com!fu-berlin.de!uni-berlin.de!tar-meneldur.cbb-automation.DE!not-for-mail From: Dmitry A. Kazakov Newsgroups: comp.lang.ada Subject: Re: abstract sub programs overriding Date: Tue, 09 Mar 2004 16:56:12 +0100 Message-ID: <0ipr40thtf86b520a0qdi003aj87gtuhd4@4ax.com> References: <5f59677c.0403060718.3d6aa909@posting.google.com> <1078776213.376775@master.nyc.kbcfp.com> <1078839257.157439@master.nyc.kbcfp.com> <5cmr40t76va200betf07b7bd6er05ltto9@4ax.com> <1078845298.702789@master.nyc.kbcfp.com> NNTP-Posting-Host: tar-meneldur.cbb-automation.de (212.79.194.119) Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Trace: news.uni-berlin.de 1078847136 65698891 I 212.79.194.119 ([77047]) X-Newsreader: Forte Agent 1.8/32.548 Xref: archiver1.google.com comp.lang.ada:6191 Date: 2004-03-09T16:56:12+01:00 List-Id: On Tue, 09 Mar 2004 10:14:45 -0500, Hyman Rosen wrote: >Dmitry A. Kazakov wrote: >> The problem is that to construct an object (A) /= to construct the >> dispatching table of its methods (B). > >If a constructor is able to call member functions, some choice must >be made as to where dispatching calls will go. No. This is necessary only if the object is class-wide, i.e. when this is treated as a class-wide pointer. Make it specific and the problem will disappear. >> C++ choice is very close to: A implies B. > >Yes. > >> Obviously it is a bad choice from many points of view. > >It's obviously a good choice from my point of view. > >> One of them is safety, as the case shows. > >As I said, if calls to member functions are to be permitted, >as they are in C++, Java, and Ada, it must be decided what >happens in the case of dispatching. Which need not to be the case. See above. >> True, but in practice it is difficult to view object construction / >> destruction as monolitic or error free. > >In C++ construction is neither monolithic nor required to be error-free, >in the sense that any constructor may throw an exception to abort the >creation of an object. ... with calling an abstract method as a consequence? >> I think that probably two stage construction is needed. > > The first one for type specific construction, the second for class-wide > > one (at least to have dispatching in constructors) > >Constructors can always pass arguments up the hierarchy in C++, >so ultimate type information is available if needed. If you want >to require the ultimate class to provide this data with no chance >of forgetting, simply inherit from a virtual base class without a >default constructor. Dispatching on class-wides, which specific objects are not fully constructed, is bogus. Nothing can heal it, even dispatching table forgery cannot. -- Regards, Dmitry Kazakov www.dmitry-kazakov.de