From: "J-P. Rosen" <rosen@adalog.fr>
Subject: Re: Equivalent of dynamic_cast (downcast) for tagged types
Date: Thu, 27 Jan 2011 18:10:49 +0100
Date: 2011-01-27T18:10:49+01:00 [thread overview]
Message-ID: <ihs8up$i7f$1@news.eternal-september.org> (raw)
In-Reply-To: <evoxe8yl0jfw.guw86vvdhuzb.dlg@40tude.net>
Le 27/01/2011 17:18, Dmitry A. Kazakov a �crit :
> if X'Tag = T'Tag then -- X is of T
> Do_Something (T (X)); -- No dispatch
> end if;
>
or
if X in T then -- slightly more elegant
>> If you say that I should not do this because it is not good practice,
It's bad practice in C++ because it is unsafe.
I see no objection in Ada, where tags are checked, and I have some
pretty convincing examples of that.
Admitedly, it not very OOrthodox, but OOrthodoxy has been defined by C++
people!
--
---------------------------------------------------------
J-P. Rosen (rosen@adalog.fr)
Adalog a d�m�nag� / Adalog has moved:
2 rue du Docteur Lombard, 92441 Issy-les-Moulineaux CEDEX
Tel: +33 1 45 29 21 52, Fax: +33 1 45 29 25 00
next prev parent reply other threads:[~2011-01-27 17:10 UTC|newest]
Thread overview: 25+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-01-27 15:46 Equivalent of dynamic_cast (downcast) for tagged types Maciej Sobczak
2011-01-27 16:18 ` Dmitry A. Kazakov
2011-01-27 17:10 ` J-P. Rosen [this message]
2011-01-27 17:35 ` Dmitry A. Kazakov
2011-01-27 22:49 ` Maciej Sobczak
2011-01-27 17:50 ` Georg Bauhaus
2011-01-27 22:35 ` Maciej Sobczak
2011-01-28 5:07 ` Yannick Duchêne (Hibou57)
2011-01-28 9:16 ` Dmitry A. Kazakov
2011-01-28 13:11 ` AdaMagica
2011-01-28 14:13 ` Dmitry A. Kazakov
2011-01-28 23:51 ` Randy Brukardt
2011-01-29 0:55 ` Adam Beneschan
2011-01-28 16:44 ` Adam Beneschan
2011-01-28 17:21 ` Dmitry A. Kazakov
2011-01-29 0:12 ` Randy Brukardt
2011-01-29 8:47 ` Dmitry A. Kazakov
2011-01-28 17:33 ` Adam Beneschan
2011-01-28 15:13 ` Maciej Sobczak
2011-01-28 17:47 ` Robert A Duff
2011-01-28 22:04 ` Maciej Sobczak
2011-01-30 20:22 ` Stephen Leake
2011-01-31 9:04 ` AdaCore, user community and communication channels Maciej Sobczak
2011-01-31 10:42 ` Georg Bauhaus
2011-01-27 19:33 ` Equivalent of dynamic_cast (downcast) for tagged types Adam Beneschan
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox