comp.lang.ada
 help / color / mirror / Atom feed
From: Robert A Duff <bobduff@shell01.TheWorld.com>
Subject: Re: Task entries and access to subprograms.
Date: 07 Apr 2005 10:01:35 -0400
Date: 2005-04-07T10:01:35-04:00	[thread overview]
Message-ID: <wccd5t64reo.fsf@shell01.TheWorld.com> (raw)
In-Reply-To: 4254E00C.30908@mailinator.com

"Alex R. Mosteo" <devnull@mailinator.com> writes:

> I see reading the rationale that here the prohibition is more of a
> convenience for the compiler writers than a true restriction for users.

AARM-9.5.2 explains the reason for the rule.  I'd say "convenience" is
an understatement.  ;-)

13    An entry_declaration in a task declaration shall not contain a
specification for an access parameter (see 3.10).

    13.a Reason: Access parameters for task entries would require a
          complex implementation. For example:

    13.b  task T is
             entry E(Z : access Integer); -- Illegal!
          end T;

    13.c  task body T is
          begin
             declare
                type A is access all Integer;
                X : A;
                Int : aliased Integer;
                task Inner;
                task body Inner is
                begin
                   T.E(Int'Access);
                end Inner;
             begin
                accept E(Z : access Integer) do
                   X := A(Z); -- Accessibility_Check
                end E;
             end;
          end T;

    13.d Implementing the Accessibility_Check inside the
       accept_statement for E is difficult, since one does not know
       whether the entry caller is calling from inside the immediately
       enclosing declare block or from outside it. This means that the
       lexical nesting level associated with the designated object is
       not sufficient to determine whether the Accessibility_Check
       should pass or fail.

    13.e Note that such problems do not arise with protected entries,
       because entry_bodies are always nested immediately within the
       protected_body; they cannot be further nested as can
       accept_statements, nor can they be called from within the
       protected_body (since no entry calls are permitted inside a
       protected_body).

I don't see any reasonable alternative rule, other than to forbid those
pesky nested accept statements, which was not an option because that was
already allowed in Ada 83.

- Bob



  reply	other threads:[~2005-04-07 14:01 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-04-06 10:25 Task entries and access to subprograms Alex R. Mosteo
2005-04-06 10:54 ` Adrien Plisson
2005-04-06 12:06 ` Dmitry A. Kazakov
2005-04-06 12:22   ` Alex R. Mosteo
2005-04-07  2:05 ` Jeffrey Carter
2005-04-07  7:23   ` Alex R. Mosteo
2005-04-07 14:01     ` Robert A Duff [this message]
2005-04-07 23:23     ` Randy Brukardt
2005-04-08  6:49       ` Alex R. Mosteo
2005-04-08 14:49         ` Robert A Duff
2005-04-08 15:23           ` Dmitry A. Kazakov
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox