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=-0.9 required=5.0 tests=BAYES_00,FORGED_GMAIL_RCVD, FREEMAIL_FROM autolearn=no autolearn_force=no version=3.4.4 X-Google-Thread: 103376,f428ff2031155951 X-Google-NewGroupId: yes X-Google-Attributes: gida07f3367d7,domainid0,public,usenet X-Google-Language: ENGLISH,ASCII Path: g2news1.google.com!postnews.google.com!r4g2000vbq.googlegroups.com!not-for-mail From: Maciej Sobczak Newsgroups: comp.lang.ada Subject: Re: Equivalent of dynamic_cast (downcast) for tagged types Date: Thu, 27 Jan 2011 14:49:37 -0800 (PST) Organization: http://groups.google.com Message-ID: <026d387e-1dd9-4551-b06a-5a5fa471ddd1@r4g2000vbq.googlegroups.com> References: <375fb596-ab12-4cb0-a190-53d62b94b2e4@e9g2000vbi.googlegroups.com> NNTP-Posting-Host: 81.62.44.201 Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable X-Trace: posting.google.com 1296168577 29230 127.0.0.1 (27 Jan 2011 22:49:37 GMT) X-Complaints-To: groups-abuse@google.com NNTP-Posting-Date: Thu, 27 Jan 2011 22:49:37 +0000 (UTC) Complaints-To: groups-abuse@google.com Injection-Info: r4g2000vbq.googlegroups.com; posting-host=81.62.44.201; posting-account=bMuEOQoAAACUUr_ghL3RBIi5neBZ5w_S User-Agent: G2/1.0 X-HTTP-UserAgent: Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.5; en-US; rv:1.9.2.10) Gecko/20100914 Firefox/3.6.10,gzip(gfe) Xref: g2news1.google.com comp.lang.ada:16755 Date: 2011-01-27T14:49:37-08:00 List-Id: On Jan 27, 6:10=A0pm, "J-P. Rosen" wrote: > It's bad practice in C++ because it is unsafe. It is perfectly safe in the form that I have presented. Another version with references is also perfectly safe, as it does not even produce any null pointer value and throws an exception - which is equivalent to what Ada does. > Admitedly, it not very OOrthodox, but OOrthodoxy has been defined by C++ > people! Please note that object orientation actually works in C++, whereas it demonstrably doesn't work with GNAT (see my response to Dmitry for details) and we are talking about the time gap of some 20 years. I fully understand your opinion about C++, but in this particular case it would be very difficult to defend. OK, now ducking away to move forward my Ada project. ;-) -- Maciej Sobczak * http://www.inspirel.com