comp.lang.ada
 help / color / mirror / Atom feed
From: Adam Beneschan <adam@irvine.com>
Subject: Re: Equivalent of dynamic_cast (downcast) for tagged types
Date: Fri, 28 Jan 2011 09:33:49 -0800 (PST)
Date: 2011-01-28T09:33:49-08:00	[thread overview]
Message-ID: <b325404a-7828-4a06-a0d6-e04b34f36fc1@n2g2000pre.googlegroups.com> (raw)
In-Reply-To: 242e5c66-04cf-46a0-ae33-5f4d70946b51@l22g2000pre.googlegroups.com

On Jan 28, 8:44 am, Adam Beneschan <a...@irvine.com> wrote:

> > It must be overriding because Adjust is a primitive operation.
>
> Wrong.
>
> I can't find the language rule right now, but I'm certain that if a
> tagged type T has a primitive operation Op declared in the private
> part, and another package declares a type extension of T and declares
> its own operation Op with the same profile, in a place where the first
> Op is not visible, then the new Op is a **new** operation that has no
> connection with the Op in the private part of the first package.  This
> is what I would expect, since the private part of a package isn't
> supposed to have any semantic effect on places that can't see the
> private part.

Some clarifications:

(1) The above doesn't apply if the "another package" is a child
package.  Thus, in my example, if you change Pak2 to Pak1.Pak2, that
changes the result, because the Op2 in Pak1.Pak2 does override an
inherited operation that is implicitly declared in the private part of
Pak1.Pak2 (even though the private part of Pak1.Pak2 is itself
implicit; it's still there).  But when the package is not a child
package, the inherited operation is not declared at all, so there's no
overriding.

(2) I think the language rules involved are around 3.9.2(20ff); AARM
3.9.2(20.a.3/3) seems to be the most important explanation in this
case.  See also AI05-126.

                                 -- Adam




  parent reply	other threads:[~2011-01-28 17:33 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
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 [this message]
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