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: a07f3367d7,c71f34d397d73b8e X-Google-Attributes: gida07f3367d7,public,usenet X-Google-NewGroupId: yes X-Google-Language: ENGLISH,ASCII-7-bit X-Received: by 10.180.106.161 with SMTP id gv1mr1254006wib.4.1364344635003; Tue, 26 Mar 2013 17:37:15 -0700 (PDT) MIME-Version: 1.0 Path: ex12ni5423wid.1!nntp.google.com!feeder1.cambriumusenet.nl!82.197.223.103.MISMATCH!feeder3.cambriumusenet.nl!feed.tweaknews.nl!193.141.40.65.MISMATCH!npeer.de.kpn-eurorings.net!npeer-ng0.de.kpn-eurorings.net!border2.nntp.ams2.giganews.com!border4.nntp.ams.giganews.com!border2.nntp.ams.giganews.com!border2.nntp.dca.giganews.com!border3.nntp.dca.giganews.com!border1.nntp.dca.giganews.com!nntp.giganews.com!newsgate.cuhk.edu.hk!goblin3!goblin.stu.neva.ru!news.franciliens.net!news.muarf.org!news.ecp.fr!news.jacob-sparre.dk!munin.jacob-sparre.dk!pnx.dk!.POSTED!not-for-mail From: "Randy Brukardt" Newsgroups: comp.lang.ada Subject: Re: User-Defined Reference in a Task Type Discriminant Compiler Bug? Date: Thu, 21 Mar 2013 18:49:21 -0500 Organization: Jacob Sparre Andersen Research & Innovation Message-ID: References: <4ef5e6b7-aab3-4229-a245-97dfc5861b8d@googlegroups.com> NNTP-Posting-Host: static-69-95-181-76.mad.choiceone.net X-Trace: munin.nbi.dk 1363909770 10666 69.95.181.76 (21 Mar 2013 23:49:30 GMT) X-Complaints-To: news@jacob-sparre.dk NNTP-Posting-Date: Thu, 21 Mar 2013 23:49:30 +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.6157 Date: 2013-03-21T18:49:21-05:00 List-Id: "Eryndlia Mavourneen" wrote in message news:4ef5e6b7-aab3-4229-a245-97dfc5861b8d@googlegroups.com... ... >Note that the declaration of Inc_Type in (1) is properly recognized as an >access-to-subprogram >type without the aspect clause. I find it odd that the declaration of the >discriminant + aspect clause >given a similar circumstance will not compile. It appears to prevent >implicitly the type of construct >in (1), which seems to me to be legal Ada code. It's not, Adam explained why. "Access discriminant" only refers to discriminants with an anonymous access type. This is important because special accessibility rules apply to such discriminants, and those accessibility rules are what makes it safe to return these things. (Essentially, it is almost impossible to copy the access value, and that means that it can only be used for immediate dereferencing.) As far as using an access-to-subprogram in one of these, I don't think we ever considered that. It's not particularly useful, either, as the primary intention was to provide convinient write-in-place for elements of containers. But you can never write to a subprogram call. You can get the same effect by just returning the access type from a function; you don't need the "Implicit_Dereference" mechanism for that. So it doesn't surprise me that it doesn't work in GNAT. I don't understand your use-case, either. If you want to call the access-to-subprogram discriminant from inside the task, just do that -- the Implicit_Dereference is not necessary. And if you want the routine to somehow call the task, I don't think that's likely to work -- you won't be able to get access to the task object from inside the subprogram and thus you can't call an operation of the task from there. So I don't see any point to what you're trying to do. Randy.