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!.POSTED!not-for-mail From: Brian Drummond Newsgroups: comp.lang.ada Subject: Re: Question about name resolution Date: Wed, 21 Jan 2015 10:54:39 +0000 (UTC) Organization: A noiseless patient Spider Message-ID: References: Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Injection-Date: Wed, 21 Jan 2015 10:54:39 +0000 (UTC) Injection-Info: mx02.eternal-september.org; posting-host="da745e888d4a5182b5fda6212bbb0a63"; logging-data="10699"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+TAu+PDj3pSgRsmjL03eIN0q0cTYENa1M=" User-Agent: Pan/0.139 (Sexual Chocolate; GIT bf56508 git://git.gnome.org/pan2) Cancel-Lock: sha1:QnDi9WAC/nsBgid8Wc7omTJioLI= Xref: news.eternal-september.org comp.lang.ada:24666 Date: 2015-01-21T10:54:39+00:00 List-Id: On Tue, 20 Jan 2015 17:47:20 -0700, Jeffrey Carter wrote: > On 01/20/2015 12:32 PM, Michael B. wrote: >> >> I was surprised that this compiles without warnings if neither of the >> procedures is called. Why is such overloading allowed in Ada? It seems >> to make no sense to write a procedure that cannot be called directly. > In Ada 83 and later, the call > > F (5) > > is ambiguous. It could either be > > F1 with an argument of 5 > > or > > F2 with the result indexed by 5 > > In Ada 80 this was unambiguous; the call could only be to F1. To call F2 > one had to write > > F () (5) > > This is not very helpful but I always like an excuse to air the useless > trivia in my head. Similar ambiguity was inherited by VHDL. Some big-name simulators still get it wrong, arbitrarily resolving the ambiguity as F1 with argument, some failing to compile legal VHDL where the ambiguity could be resolved by the return type. For example where F returns a string of specified (or default) length: function F(Len : Natural := 5) return String; variable c: character := F(5); is legal, unambiguous, yet rejected by some embarrassingly expensive tools, where variable s : string := "hello " & F(5); is ambiguous (because "&") overloads) but arbitrarily resolved as concatenating two strings. -- Brian -- Brian