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-Thread: a07f3367d7,f428ff2031155951 X-Google-Attributes: gida07f3367d7,public,usenet X-Google-NewGroupId: yes X-Google-Language: ENGLISH,ASCII Path: g2news1.google.com!news3.google.com!feeder2.cambriumusenet.nl!feeder1.cambriumusenet.nl!feed.tweaknews.nl!216.196.110.149.MISMATCH!border2.nntp.ams.giganews.com!nntp.giganews.com!eternal-september.org!feeder.eternal-september.org!.POSTED!not-for-mail From: "J-P. Rosen" Newsgroups: comp.lang.ada Subject: Re: Equivalent of dynamic_cast (downcast) for tagged types Date: Thu, 27 Jan 2011 18:10:49 +0100 Organization: Adalog Message-ID: References: <375fb596-ab12-4cb0-a190-53d62b94b2e4@e9g2000vbi.googlegroups.com> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8bit Injection-Date: Thu, 27 Jan 2011 17:10:50 +0000 (UTC) Injection-Info: mx01.eternal-september.org; posting-host="cJo7kSTQUrCFv2/D8KKtqw"; logging-data="18671"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19ElmdsXYc5jIiQPXz2ZLkY" User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; fr; rv:1.9.2.13) Gecko/20101207 Thunderbird/3.1.7 In-Reply-To: Cancel-Lock: sha1:4glMmnFB2bfp1KrfyPIFjgBzKSg= Xref: g2news1.google.com comp.lang.ada:16743 Date: 2011-01-27T18:10:49+01:00 List-Id: 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