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.3 required=5.0 tests=BAYES_00, REPLYTO_WITHOUT_TO_CC autolearn=no autolearn_force=no version=3.4.4 X-Google-Thread: 103376,90108ed846e3f1bf X-Google-Attributes: gid103376,domainid0,public,usenet X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news1.google.com!news2.google.com!news1.google.com!news.glorb.com!news2.arglkargh.de!feeder.erje.net!newsfeed01.sul.t-online.de!t-online.de!newsfeed.arcor.de!newsspool1.arcor-online.net!news.arcor.de.POSTED!not-for-mail From: "Dmitry A. Kazakov" Subject: Re: Language lawyer question: task activation Newsgroups: comp.lang.ada User-Agent: 40tude_Dialog/2.0.15.1 MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Reply-To: mailbox@dmitry-kazakov.de Organization: cbb software GmbH References: Date: Thu, 19 Feb 2009 18:57:10 +0100 Message-ID: <1dusr7frk73m7.nlsagplge0hk.dlg@40tude.net> NNTP-Posting-Date: 19 Feb 2009 18:57:12 CET NNTP-Posting-Host: fffc30d0.newsspool3.arcor-online.net X-Trace: DXC=BJ1K;@\dDNcfSJ;bb[5IRnRBaCdG0f]C^d2@F0SBNVPWTQ[m< X-Complaints-To: usenet-abuse@arcor.de Xref: g2news1.google.com comp.lang.ada:3706 Date: 2009-02-19T18:57:12+01:00 List-Id: On Thu, 19 Feb 2009 09:37:31 -0800 (PST), Adam Beneschan wrote: > with Text_IO; > procedure Test is > > task type TType is > entry E1; > end TType; > > task body TType is > begin > accept E1 do > Text_IO.Put_Line ("E1 accepted"); > end E1; > end TType; > > function Func return TType is > begin > return X : TType; > end Func; > > procedure Do_It (X : TType) is > begin > X.E1; > end Do_It; > > begin > Do_It (Func); > end Test; Cool! I am not a language lawyer but I think it is a bug. Even more funny it becomes with: function Func return TType is begin return X : TType do X.E1; -- Communicating with not yet returned object! end return; end Func; I guess that GNAT does not fire the task until its "construction," which happens too late in these cases. I cannot tell if this behavior is correct. Anyway is nicely illustrates why 2005 return statements and Pickwickian functions are bogus. Let's see what others say. -- Regards, Dmitry A. Kazakov http://www.dmitry-kazakov.de