From: Robert A Duff <bobduff@shell01.TheWorld.com>
Subject: Re: Question about name resolution
Date: Tue, 20 Jan 2015 14:43:57 -0500
Date: 2015-01-20T14:43:57-05:00 [thread overview]
Message-ID: <wccmw5db5ky.fsf@shell01.TheWorld.com> (raw)
In-Reply-To: m9m7s8$3g8$1@speranza.aioe.org
"Michael B." <michaelb@example.com> writes:
> The following example does not compile because the call to "P" is ambiguous:
>
> procedure Main is
>
> procedure P is
> begin
> null;
> end P;
>
> procedure P (I : Integer := 0) is
> begin
> null;
> end P;
>
> begin
> P;
> end Main;
>
> What syntax is needed to call the first "P" without parameters?
The correct syntax is as follows:
procedure Main is
procedure Some_Other_Name is
begin
null;
end Some_Other_Name;
procedure P (I : Integer := 0) is
begin
null;
end P;
begin
P;
end Main;
There are three ways to resolve overloading ambiguities:
1. Change the names (use less overloading).
2. Use qualified expressions (e.g. String'(F(X))).
3. Use expanded names (e.g. Package_Name.Procedure_Name).
Only 1 works here.
If the things are declared in third-party libraries that you can't
change (or don't want to), then only 2 and 3 work. Otherwise, if you're
getting a lot of ambiguities, 1 is often (usually?) the right way.
- Bob
prev parent reply other threads:[~2015-01-20 19:43 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-01-20 18:47 Question about name resolution Michael B.
2015-01-20 19:00 ` Jeffrey Carter
2015-01-20 19:32 ` Michael B.
2015-01-20 20:39 ` Robert A Duff
2015-01-21 18:25 ` Michael B.
2015-01-21 0:47 ` Jeffrey Carter
2015-01-21 10:54 ` Brian Drummond
2015-01-20 19:43 ` Robert A Duff [this message]
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox