From: "Dmitry A. Kazakov" <mailbox@dmitry-kazakov.de>
Subject: Re: What makes a procedure call 'dispatching' in Ada?
Date: Fri, 20 Nov 2009 15:31:26 +0100
Date: 2009-11-20T15:31:26+01:00 [thread overview]
Message-ID: <1ced67sbv38ke.1973smwq7n0uw.dlg@40tude.net> (raw)
In-Reply-To: 4b06a048$0$26319$4f793bc4@news.tdc.fi
On Fri, 20 Nov 2009 15:56:50 +0200, Niklas Holsti wrote:
> Dmitry has philosophical objections to redispatching, which is why he
> suggests that you should declare P with a class-type parameter THIS in
> the first place, so that A (THIS) will dispatch.
I would not call them philosophical. If you see the code like
if X = 1 then
...
if X = 1 then
...
end if;
...
if X = 1 then
...
end if;
...
you start suggesting that there could be something wrong here. Re-dispatch
is not an error it is an indication of a potential design problem. Why
would you need to check twice the same tag? That requires an explanation in
the design document and comments in the code.
A technical issue is that if we had tagged types of value semantics (i.e.
classes rooted in Boolean, Integer etc), then re-dispatch could not work
with them. I.e. from Ada's agnostic point of view on by-value vs.
by-reference, re-dispatch (or speaking more generally, view conversion to
T'Class) is an implementation-specific kludge.
--
Regards,
Dmitry A. Kazakov
http://www.dmitry-kazakov.de
next prev parent reply other threads:[~2009-11-20 14:31 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-11-20 13:15 What makes a procedure call 'dispatching' in Ada? Markus Schoepflin
2009-11-20 9:31 ` stefan-lucks
2009-11-20 14:10 ` Niklas Holsti
2009-11-20 13:27 ` Dmitry A. Kazakov
2009-11-20 13:43 ` Markus Schoepflin
2009-11-20 13:54 ` RasikaSrinivasan@gmail.com
2009-11-20 13:58 ` Markus Schoepflin
2009-11-20 14:19 ` Niklas Holsti
2009-11-21 14:07 ` Peter C. Chapin
2009-11-20 14:00 ` Niklas Holsti
2009-11-20 14:10 ` Dmitry A. Kazakov
2009-11-20 13:56 ` Niklas Holsti
2009-11-20 14:31 ` Dmitry A. Kazakov [this message]
2009-11-20 15:00 ` Niklas Holsti
2009-11-20 18:44 ` Dmitry A. Kazakov
2009-11-20 20:09 ` Niklas Holsti
2009-11-20 20:59 ` Dmitry A. Kazakov
2009-11-20 14:54 ` Ludovic Brenta
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox