comp.lang.ada
 help / color / mirror / Atom feed
From: dmitry@elros.cbb-automation.de (Dmitry A. Kazakov)
Subject: Re: Merits of re-dispatching
Date: Tue, 19 Feb 2002 09:20:06 GMT
Date: 2002-02-19T09:20:06+00:00	[thread overview]
Message-ID: <3c721028.221281@News.CIS.DFN.DE> (raw)
In-Reply-To: memo.20020218194741.37959A@brangdon.madasafish.com

On Mon, 18 Feb 2002 19:47 +0000 (GMT Standard Time),
brangdon@cix.co.uk (Dave Harris) wrote:

>dmitry@elros.cbb-automation.de (Dmitry A. Kazakov) wrote (abridged):
>> > This should produce B.Foo B.Foo A.Foo A.Foo.
>> 
>> With my correction it will produce:
>> 
>> B.Foo B.Foo B.Foo A.Foo.
>
>Right. So you see that Ada is different from C++, and your description of 
>C++ in Ada terms gives the wrong results. You said earlier that:
>
>    That is one of several possible interpretation of what happens
>    in C++ using Ada terms.
>
>but the other interpretation you offered doesn't correspond to how C++ 
>behaves.

My interpretation was that if C++ dispatches then it treats the type
as class wide,, otherwise as specific. Then the  object is always
treated as specific in all calls from destructor. So what? Maybe it is
hard to simulate, but well possible to explain.

>That was my only point, really. 
>
>> Why on earth a call to Foo from B.Finalize should dispatch? The type
>> is known, so there is only one version of Foo to be called.
>
>Let's not muddle the issue with compiler optimisations. A C++ compiler is 
>allowed to replace dynamic dispatch with static if it can deduce the 
>dynamic type of the object at compile-time.

Which is almost impossible in general case. However it has nothing to
do with optimisation. It is the language design issue.

>Constructors are not a special 
>case (although the deduction is unusually simple for them). All of this is 
>under the "as if" rule. C++ must behave as if it dynamically dispatched in 
>constructors.

Regards,
Dmitry Kazakov



  reply	other threads:[~2002-02-19  9:20 UTC|newest]

Thread overview: 36+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-02-07 10:26 Merits of re-dispatching [LONG] Dmitry A. Kazakov
2002-02-07 15:03 ` Hyman Rosen
2002-02-08  1:29   ` Matthew Heaney
2002-02-08  9:16     ` Dmitry A. Kazakov
2002-02-08 18:30       ` Hyman Rosen
2002-02-09  0:10         ` Matthew Heaney
2002-02-12  8:32         ` Dmitry A. Kazakov
2002-02-12 21:37           ` Hyman Rosen
2002-02-13  9:29             ` Dmitry A. Kazakov
2002-02-13 14:32               ` Hyman Rosen
2002-02-13 19:58           ` Dave Harris
2002-02-14 15:06             ` Dmitry A. Kazakov
2002-02-16 12:10               ` Dave Harris
2002-02-18  8:57                 ` Dmitry A. Kazakov
2002-02-18 19:47                   ` Merits of re-dispatching Dave Harris
2002-02-19  9:20                     ` Dmitry A. Kazakov [this message]
2002-02-21  5:49                       ` Hyman Rosen
2002-02-21  9:04                         ` Dmitry A. Kazakov
2002-02-21 18:17                           ` Hyman Rosen
2002-02-22  9:21                             ` Dmitry A. Kazakov
2002-02-22 16:59                               ` Hyman Rosen
2002-02-25  8:51                                 ` Dmitry A. Kazakov
2002-02-08 23:51       ` Merits of re-dispatching [LONG] Matthew Heaney
2002-02-12  9:02         ` Dmitry A. Kazakov
2002-02-07 23:40 ` Nick Roberts
2002-02-08  8:56   ` Dmitry A. Kazakov
2002-02-08  1:06 ` Matthew Heaney
2002-02-08  9:48   ` Dmitry A. Kazakov
2002-02-09  0:16     ` Matthew Heaney
2002-02-08 18:10   ` Hyman Rosen
2002-02-09  0:41     ` Matthew Heaney
2002-02-08 18:33 ` Nick Roberts
2002-02-09  4:07   ` Nick Roberts
2002-02-12 10:13   ` Dmitry A. Kazakov
2002-02-14 20:57 ` Tucker Taft
2002-02-15 15:43   ` Dmitry A. Kazakov
replies disabled

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