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=-1.9 required=5.0 tests=BAYES_00 autolearn=unavailable autolearn_force=no version=3.4.4 Path: eternal-september.org!reader01.eternal-september.org!reader02.eternal-september.org!news.eternal-september.org!mx02.eternal-september.org!feeder.eternal-september.org!feeder.erje.net!eu.feeder.erje.net!bloom-beacon.mit.edu!bloom-beacon.mit.edu!newsswitch.lcs.mit.edu!nntp.TheWorld.com!.POSTED!not-for-mail From: Robert A Duff Newsgroups: comp.lang.ada Subject: Re: Question about name resolution Date: Tue, 20 Jan 2015 14:43:57 -0500 Organization: The World Public Access UNIX, Brookline, MA Message-ID: References: NNTP-Posting-Host: shell01.theworld.com Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: pcls7.std.com 1421783039 22314 192.74.137.71 (20 Jan 2015 19:43:59 GMT) X-Complaints-To: abuse@TheWorld.com NNTP-Posting-Date: Tue, 20 Jan 2015 19:43:59 +0000 (UTC) User-Agent: Gnus/5.1008 (Gnus v5.10.8) Emacs/21.3 (irix) Cancel-Lock: sha1:OjVDpwNIf6uDdU75v/jr60m8dDQ= Xref: news.eternal-september.org comp.lang.ada:24640 Date: 2015-01-20T14:43:57-05:00 List-Id: "Michael B." 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