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.9 required=5.0 tests=BAYES_00,FORGED_GMAIL_RCVD, FREEMAIL_FROM autolearn=no autolearn_force=no version=3.4.4 X-Google-Thread: 103376,de7dd126d6737f3a X-Google-NewGroupId: yes X-Google-Attributes: gida07f3367d7,domainid0,public,usenet X-Google-Language: ENGLISH,ASCII Path: g2news1.google.com!postnews.google.com!e4g2000vbi.googlegroups.com!not-for-mail From: Maciej Sobczak Newsgroups: comp.lang.ada Subject: Re: Callback in Ada Date: Mon, 29 Nov 2010 02:12:33 -0800 (PST) Organization: http://groups.google.com Message-ID: References: <8lc2d0Fb6jU1@mid.individual.net> <4cf0ec67$0$6882$9b4e6d93@newsspool2.arcor-online.net> <393221c0-ac56-436f-b3f8-280c40d5a53a@j1g2000vbl.googlegroups.com> NNTP-Posting-Host: 137.138.182.236 Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable X-Trace: posting.google.com 1291025553 19036 127.0.0.1 (29 Nov 2010 10:12:33 GMT) X-Complaints-To: groups-abuse@google.com NNTP-Posting-Date: Mon, 29 Nov 2010 10:12:33 +0000 (UTC) Complaints-To: groups-abuse@google.com Injection-Info: e4g2000vbi.googlegroups.com; posting-host=137.138.182.236; posting-account=bMuEOQoAAACUUr_ghL3RBIi5neBZ5w_S User-Agent: G2/1.0 X-HTTP-UserAgent: Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.5; en-US; rv:1.9.2.10) Gecko/20100914 Firefox/3.6.10,gzip(gfe) Xref: g2news1.google.com comp.lang.ada:15694 Date: 2010-11-29T02:12:33-08:00 List-Id: On Nov 29, 9:41=A0am, "Dmitry A. Kazakov" wrote: > > And now an equivalent example with functions, please. :-) > > =A0=A0 =A0procedure Foo (Closure : function return Integer); > =A0=A0 =A0function Bar return Integer; > =A0=A0 =A0... > =A0=A0 =A0Foo (Bar); > > There is no difference. There is. > * Ada is not bottom up as C++, it can resolve using the type of the resul= t. But here there is no type of the result. Bar is not even called, so there is no result on which you could disambiguate this construct. In order to make your reasoning complete you would have to introduce additional way of using function names: 1. This way: Bar would mean that the function is called. The type of result can be used to disambiguate the overloaded calls. For the brave: watch out enumerations. 2. This way: Bar would mean that the function is *not* called, but is denoted as a first-class entity. Oops, they look the same. You have to disambiguate them. And once you do, you have to disambiguate *again*, if it happens to be 1. above. This would mean two-phase overload disambiguation. Don't even try to combine these two phases, that would be complete mess. Probably it would be better to add some attribute (like in qualified expressions) to hint the compiler whether you intend to use the function as an entity or to actually call it - but then, you gain absolutely nothing with regard to the existing 'Access attribute, which you consider as being broken. In any case, this: Foo (Bar); would add yet another ambiguity to what is already too heavily overloaded syntax. Hardly readable at all. -- Maciej Sobczak * http://www.inspirel.com