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,e9caf8720058dd5e X-Google-Attributes: gid103376,public X-Google-Language: ENGLISH,ASCII Path: g2news1.google.com!news3.google.com!proxad.net!nerim.net!oleane.net!oleane!hunter.axlog.fr!nobody From: Jean-Pierre Rosen Newsgroups: comp.lang.ada Subject: Re: embed accept statement in procedures not possible? Date: Fri, 04 May 2007 18:58:29 +0200 Organization: Adalog Message-ID: References: <1178291081.936739.131740@c35g2000hsg.googlegroups.com> NNTP-Posting-Host: mailhost.axlog.fr Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 8bit X-Trace: s1.news.oleane.net 1178298062 4632 195.25.228.57 (4 May 2007 17:01:02 GMT) X-Complaints-To: abuse@oleane.net NNTP-Posting-Date: Fri, 4 May 2007 17:01:02 +0000 (UTC) User-Agent: Thunderbird 1.5.0.10 (Windows/20070221) In-Reply-To: <1178291081.936739.131740@c35g2000hsg.googlegroups.com> Xref: g2news1.google.com comp.lang.ada:15529 Date: 2007-05-04T18:58:29+02:00 List-Id: Gerd a �crit : > My code (schematic only): > > task t is > entry e; > end t; > > task body t is > procedure p is > begin > accept e; > end p; > begin > p; > end t; > > GNAT tells me: "enclosing body for accept must be a task". But - the > accept in procedure p _is_ in a task. So why is this not allowed? > True. An accept statement must be *immediately* within a task body, not in anything enclosed in the task body. That rule is necessary to ensure that a task can accept only its own entries. Your example is of course very simple, but consider that a task can be included in another task. What if Inner_Task called your P procedure? -- --------------------------------------------------------- J-P. Rosen (rosen@adalog.fr) Visit Adalog's web site at http://www.adalog.fr