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.3 required=5.0 tests=BAYES_00, REPLYTO_WITHOUT_TO_CC 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-7-bit Path: g2news2.google.com!news3.google.com!proxad.net!feeder1-2.proxad.net!194.25.134.126.MISMATCH!newsfeed01.sul.t-online.de!t-online.de!newsfeed.arcor.de!newsspool3.arcor-online.net!news.arcor.de.POSTED!not-for-mail From: "Dmitry A. Kazakov" Subject: Re: Equivalent of dynamic_cast (downcast) for tagged types Newsgroups: comp.lang.ada User-Agent: 40tude_Dialog/2.0.15.1 MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Reply-To: mailbox@dmitry-kazakov.de Organization: cbb software GmbH References: <375fb596-ab12-4cb0-a190-53d62b94b2e4@e9g2000vbi.googlegroups.com> <510d779c-d15b-4fc1-b831-bfc578ecdb4b@z3g2000prz.googlegroups.com> <7q5flc9of9ey.19h9nmmzjxqn0.dlg@40tude.net> Date: Fri, 28 Jan 2011 15:13:08 +0100 Message-ID: NNTP-Posting-Date: 28 Jan 2011 15:13:08 CET NNTP-Posting-Host: 583ece2b.newsspool2.arcor-online.net X-Trace: DXC=D[BiD@G8lliZ]763A9EHlD;3Yc24Fo<]lROoR18kF7enW;^6ZC`4\`mfM[68DC3oP[QnXa>G^9 X-Complaints-To: usenet-abuse@arcor.de Xref: g2news2.google.com comp.lang.ada:17740 Date: 2011-01-28T15:13:08+01:00 List-Id: On Fri, 28 Jan 2011 05:11:16 -0800 (PST), AdaMagica wrote: > On 28 Jan., 10:16, "Dmitry A. Kazakov" > wrote: >> On Thu, 27 Jan 2011 14:35:28 -0800 (PST), Maciej Sobczak wrote: >>> I have submitted this bug report more than one year ago. Looks like >>> nobody even bothered to check it. >> >> Well, I am not a language lawyer to tell if the behavior (public overriding >> of a private primitive operation) is legal. >> >>> The bug submission states that Adjust is wrongly recognized as >>> overriding, which it shouldn't be - but now I have hit something more >>> interesting. >> >> It must be overriding because Adjust is a primitive operation. Whether the >> compiler should allow it to become publicly declared as an overriding is >> another question. > > The public specification of Ada.Finalization.Limited_Controlled has no > Adjust operation, so there is no primitive operation with that name > which you can override, full stop. It has no *visible* primitive operation. > It's irrelevant if there is some > internal one deeply burrowed in the compiler's implementation. Unfortunately it leaks out. Consider this: package P is type T is tagged private; private type T is tagged null record; procedure Foo (X : in out T); end P; with P; package Q is type S is new P.T with null record; procedure Foo (X : in out S); end Q; with Q; package P.R is type U is new Q.S with null record; procedure Bar (Object : in out U'Class); end P.R; package body P.R is procedure Bar (Object : in out U'Class) is begin Foo (Object); -- Which Foo is called here? Is there one or two? end Bar; end P.R; This problem can also be observed with components. E.g. P.T may have a component Baz, declared privately. Q.S may have "another" Baz declared publicly. P.R.U faces a name conflict which must be resolved in some of two possible ways: "overloading" vs. "overriding." -- Regards, Dmitry A. Kazakov http://www.dmitry-kazakov.de