comp.lang.ada
 help / color / mirror / Atom feed
From: "Dmitry A. Kazakov" <mailbox@dmitry-kazakov.de>
Subject: Re: Trouble with overriding and class-wide parameters
Date: Sat, 15 Jul 2006 21:12:00 +0200
Date: 2006-07-15T21:11:58+02:00	[thread overview]
Message-ID: <1e8oyvelt1e9p.1sv2knpvu5y8l.dlg@40tude.net> (raw)
In-Reply-To: 44b93210$0$6521$636a55ce@news.free.fr

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



  reply	other threads:[~2006-07-15 19:12 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-07-15 17:00 Trouble with overriding and class-wide parameters Yves Bailly
2006-07-15 18:00 ` Dmitry A. Kazakov
2006-07-15 18:20   ` Yves Bailly
2006-07-15 19:12     ` Dmitry A. Kazakov [this message]
2006-07-15 18:52 ` Jeffrey R. Carter
2006-07-15 20:03   ` Yves Bailly
2006-07-16  0:20     ` Jeffrey R. Carter
2006-07-16 10:00 ` Javier Miranda
2006-07-16 12:11   ` Ludovic Brenta
2006-07-16 13:36     ` Javier Miranda
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox