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,87cefb21a3c43af8 X-Google-Attributes: gid103376,public X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news2.google.com!news4.google.com!news.glorb.com!npeer.de.kpn-eurorings.net!newsfeed.arcor.de!news.arcor.de!not-for-mail From: "Dmitry A. Kazakov" Subject: Re: Trouble with overriding and class-wide parameters 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: <44b91f16$0$27041$626a54ce@news.free.fr> <44b93210$0$6521$636a55ce@news.free.fr> Date: Sat, 15 Jul 2006 21:12:00 +0200 Message-ID: <1e8oyvelt1e9p.1sv2knpvu5y8l.dlg@40tude.net> NNTP-Posting-Date: 15 Jul 2006 21:11:58 MEST NNTP-Posting-Host: 3b9bf2fc.newsread4.arcor-online.net X-Trace: DXC=JX=4Odo`hUWgQ;OFXR3=FU:ejgIfPPldTjW\KbG]kaMX^ZX8m\4PXSPEZF;0MKW2l]WRXZ37ga[7ZjTA67ckJ=XU On Sat, 15 Jul 2006 20:20:58 +0200, Yves Bailly wrote: > Dmitry A. Kazakov wrote: >> What are you trying to achieve? The code looks wrong to me. Why are you >> using access types in a procedure? Why do you want to overload two >> different Setup? If the second parameter has to be covariant then Ada does >> support it: > > It's only a very reduced sample code, extracted from a much larger > code base. The particular needs for access types are specific to > this code base. That said, replace any "not null access" for the > first parameters with "in out" and you'll get the same effect. The > second parameter *has* to be an access type, as it can be null > on purpose. See it as "parent object", in a tree-like structure > (just to give an idea). In that case yet another version of Setup without the second parameter would be a better choice. Pointers aren't much Ada way. Anyway that does no explain the motives, so it is difficult to say how to solve it in an Ada way. As for workarounds and kludges, you can use a fully qualified name the Setup you want to call to: Sub_Pkg.Setup (st'Access, ...); > I understand all of this might seem a little bit odd, now I really > would like to understand what happens and why it's not the second > Setup() (from Sub_Pkg) which is called. See the post by Jeffrey Carter. It is probably a compiler bug, because the program looks illegal. -- Regards, Dmitry A. Kazakov http://www.dmitry-kazakov.de