comp.lang.ada
 help / color / mirror / Atom feed
From: Dmitry A. Kazakov <mailbox@dmitry-kazakov.de>
Subject: Re: abstract sub programs overriding
Date: Wed, 10 Mar 2004 10:32:23 +0100
Date: 2004-03-10T10:32:23+01:00	[thread overview]
Message-ID: <b8kt40d3jti7o3r287m4gae4r6hrt1nvus@4ax.com> (raw)
In-Reply-To: 1078849973.701176@master.nyc.kbcfp.com

On Tue, 09 Mar 2004 11:32:40 -0500, Hyman Rosen <hyrosen@mail.com>
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



  reply	other threads:[~2004-03-10  9:32 UTC|newest]

Thread overview: 67+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-03-02 19:01 abstract sub programs overriding Evangelista Sami
2004-03-03  1:43 ` Stephen Leake
2004-03-05 15:02   ` Evangelista Sami
2004-03-05 16:15     ` Marius Amado Alves
2004-03-08 18:54       ` Adam Beneschan
2004-03-08 23:42         ` Marius Amado Alves
2004-03-05 16:26     ` Marius Amado Alves
2004-03-06  9:31       ` Simon Wright
2004-03-06 15:18         ` Evangelista Sami
2004-03-06 19:09           ` Marius Amado Alves
2004-03-07 12:35             ` Simon Wright
2004-03-07 13:39               ` Marius Amado Alves
2004-03-08 19:08               ` Adam Beneschan
2004-03-08 20:03                 ` Hyman Rosen
2004-03-09  8:51                   ` Dmitry A. Kazakov
2004-03-09 13:34                     ` Hyman Rosen
2004-03-09 14:49                       ` Dmitry A. Kazakov
2004-03-09 15:14                         ` Hyman Rosen
2004-03-09 15:56                           ` Dmitry A. Kazakov
2004-03-09 16:32                             ` Hyman Rosen
2004-03-10  9:32                               ` Dmitry A. Kazakov [this message]
2004-03-10 13:08                                 ` Hyman Rosen
2004-03-10 14:58                                   ` Robert I. Eachus
2004-03-10 16:00                                     ` Hyman Rosen
2004-03-10 18:07                                       ` Robert I. Eachus
2004-03-10 20:04                                         ` Hyman Rosen
2004-03-11  2:43                                           ` Robert I. Eachus
2004-03-11 13:55                                             ` Hyman Rosen
2004-03-12 23:02                                               ` Robert I. Eachus
2004-03-14 21:33                                                 ` Hyman Rosen
2004-03-15  5:59                                                   ` Robert I. Eachus
2004-03-15 14:39                                                     ` Hyman Rosen
2004-03-16 16:16                                                       ` Robert I. Eachus
2004-03-16 16:51                                                         ` Hyman Rosen
2004-03-16 19:54                                                         ` Hyman Rosen
2004-03-16 23:16                                                           ` Randy Brukardt
2004-03-17  1:54                                                           ` Robert I. Eachus
2004-03-16 23:14                                                         ` Randy Brukardt
2004-03-17  2:43                                                           ` Robert I. Eachus
2004-03-17 17:40                                                             ` Randy Brukardt
2004-03-18  2:39                                                               ` Robert I. Eachus
2004-03-18  5:57                                                                 ` Randy Brukardt
2004-03-18 15:03                                                                   ` Hyman Rosen
2004-03-18 20:32                                                                     ` Randy Brukardt
2004-03-19  3:59                                                                       ` Hyman Rosen
2004-03-19 19:37                                                                         ` Randy Brukardt
2004-03-16  6:00                                               ` Randy Brukardt
2004-03-11 10:09                                   ` Dmitry A. Kazakov
2004-03-11 14:10                                     ` Hyman Rosen
2004-03-11 14:59                                       ` Dmitry A. Kazakov
2004-03-11 15:40                                         ` Hyman Rosen
2004-03-11 16:28                                           ` Dmitry A. Kazakov
2004-03-11 17:26                                             ` Hyman Rosen
2004-03-12  8:53                                               ` Dmitry A. Kazakov
2004-03-12 13:09                                                 ` Hyman Rosen
2004-03-12 14:00                                                   ` Dmitry A. Kazakov
2004-03-12 14:56                                                     ` Hyman Rosen
2004-03-12 18:19                                                       ` Dmitry A. Kazakov
2004-03-12 18:34                                                         ` Hyman Rosen
2004-03-12 20:05                                                           ` Georg Bauhaus
2004-03-13 10:12                                                           ` Dmitry A. Kazakov
2004-03-12 18:07                                               ` Robert I. Eachus
2004-03-10 15:51                 ` Evangelista Sami
2004-03-11  1:38                   ` Dan Eilers
2004-03-06 23:20     ` Dan Eilers
2004-03-03 12:00 ` Marius Amado Alves
2004-03-13  7:51 ` Simon Wright
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox