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=ham 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-7-bit Path: g2news1.google.com!news4.google.com!proxad.net!feeder1-2.proxad.net!news.in2p3.fr!in2p3.fr!news.ecp.fr!news.jacob-sparre.dk!pnx.dk!not-for-mail From: "Randy Brukardt" Newsgroups: comp.lang.ada Subject: Re: Callback in Ada Date: Mon, 29 Nov 2010 19:32:55 -0600 Organization: Jacob Sparre Andersen Message-ID: References: <8lc2d0Fb6jU1@mid.individual.net> <4cf0ec67$0$6882$9b4e6d93@newsspool2.arcor-online.net> <393221c0-ac56-436f-b3f8-280c40d5a53a@j1g2000vbl.googlegroups.com> <10p6vzd761rdz$.1gtmc0fk6t9rb.dlg@40tude.net> NNTP-Posting-Host: static-69-95-181-76.mad.choiceone.net X-Trace: munin.nbi.dk 1291080777 2028 69.95.181.76 (30 Nov 2010 01:32:57 GMT) X-Complaints-To: news@jacob-sparre.dk NNTP-Posting-Date: Tue, 30 Nov 2010 01:32:57 +0000 (UTC) X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2900.5931 X-RFC2646: Format=Flowed; Original X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.5931 Xref: g2news1.google.com comp.lang.ada:15705 Date: 2010-11-29T19:32:55-06:00 List-Id: "Dmitry A. Kazakov" wrote in message news:10p6vzd761rdz$.1gtmc0fk6t9rb.dlg@40tude.net... ... > P.P.S. As Ada strives to introduce procedural-literals, e.g. conditional > expressions, fancy quantified expressions and other awful stuff, it will > inevitably require subprogram types, because you cannot get pointer of a > literal. What is all this mess worth of if it cannot be given as a > parameter? No problem here, just use an expression function to give your expression a name (and parameters); then you can use 'Access just fine. Forget anonymous stuff, it only leads to heartache. :-) function Foobar (A : Integer) return Integer is (if A > 10 then A - 5 else A); [The only exception is anonymous access-to-subprogram, and that is because of the special closure semantics. It would have been better to use a keyword to get that semantics, something like: type Local_Sub is local access function (A : Integer) return Integer; but this isn't sufficiently broken for such a change.] Randy. Randy.