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-10 01:21:47 PST Path: archiver1.google.com!news1.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: Wed, 10 Mar 2004 10:32:23 +0100 Message-ID: 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> 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 1078910505 66822340 I 212.79.194.119 ([77047]) X-Newsreader: Forte Agent 1.8/32.548 Xref: archiver1.google.com comp.lang.ada:6206 Date: 2004-03-10T10:32:23+01:00 List-Id: On Tue, 09 Mar 2004 11:32:40 -0500, Hyman Rosen wrote: >Dmitry A. Kazakov wrote: >> 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. > >This is a vacuous statement. Yes, if you don't dispatch at all, then >you don't have to decide where dispatching goes. Absolutely >If you want to make your own language where this is the case, go ahead, I will stay with Ada for a while (:-)) >but C++, Java, and Ada all allow (re)dispatching. 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++ 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? > >No. In Java construction is not monolithic or exception-free either, >but there dispatching always uses the most derived type. Calling an >abstract method through dispatching from a *tor is a consequence of >C++ preventing methods from running on unconstructed objects. As I >keep saying, since such dispatching is easily detected, it's not a >problem in practice. Erroneous code is caught at the point of error. > >> Dispatching on class-wides, which specific objects are not fully >> constructed, is bogus. Nothing can heal it, even dispatching table >> forgery cannot. > >And yet, unless you program in a language which prevents such >dispatching from occurring, some decision must be made. None of >C++, Java, nor Ada agree that such dispatching should be prohibited, >so clearly your point of view is far from common. Huh. So the common point of view is that dispatching on unconstructed objects is good? Note also that in Ada it cannot happen. Initialize is not a "first stage" constructor. It is called when all components of the object have been constructed by "pre-constructors". For example: type X is new Ada.Finalization.Controlled with null record; procedure Initialize (Object : in out X); type Y is new X with record New_Field : Integer := 10; end record; procedure Initialize (Object : in out Y); When either of Initialize is called on an instance of Y, New_Field is already "pre-constructed" and so contains 10. This solves a lot of problems. And it is much close to what I wished to see in a good programming language than C++ offers. As I said, IMO two-stage construction is probably the only way. -- Regards, Dmitry Kazakov www.dmitry-kazakov.de