[comp.lang.ada] nested accepts ?

Bryan@SIERRA.STANFORD.EDU (Doug Bryan) (05/10/87)

[ this is a retransmission of an earlier message for which I never received
  an echo... thus, some nets may get this twice, sorry. doug ]

Dear Ada Fans,

Consider:

	task T is
	   entry A;
	   entry B;
	end T;

then within the body of T, the following is valid,

	accept A do
	   accept B;
	end A;

but NOT:

	accept A do
	   accept A;		-- illegal: RM 9.5(8)
	end A;

Does anyone know why?  What is the rationale for this restriction?
We have checked the draft of the Rationale, RM, Barnes, Cohen,
"Evaluating Ada", the Compiler Implementor's Guide, Language
Maintenance Committee Notes, *and* Booch.  Did we miss something?

We have discussed this internally within our group here at Stanford
and some possible explanations follow.

David Rosenblum has suggested that:

   "There must be a very subtle rationale for the rule disallowing
    nested accepts for the same entry or entry family.  It may be
    a ramification of other rules.  E.g., 8.1:3 says that a single
    declarative region is formed by the text of an entry declaration
    together with the corresponding accept statements.  I.e., individual
    accept statements are only part of a declarative region and do
    not by themselves form a single declarative region.  Nested
    accepts for the same entry would in effect introduce multiple declarations,
    i.e. homographs, of the same formal parameter names, within
    the same declarative region; this is disallowed by 8.3:17.  Allowing
    nesting in the case of parameterless entries would be a messy
    special case."

David Luckham has suggested that:

   "There is no attempt in any book, or the incomplete rationale to explain it.
    One possibility, is that
	accept E1 do
	    accept E1;
	end E1;
    messes up the FIFO discipline for accepting calls, since the later (inner
    accept) releases a later caller before an earlier one."

Any more clues would be appreciated.

doug and geoff
-------

jbg@sei.cmu.edu (John Goodenough) (05/11/87)

In response to a question during the design phase objecting to the rule
forbidding nested accepts for the same entry, the design team replied.  "[This
restriction is] motivated by difficulties with the visibility rules ..."
(This quote is from the response to comment #4490 on the draft RM Chapters.)
(At one point, the design team wanted to forbid nested accepts entirely, but
it was persuaded to allow them insofar as possible.)

John Goodenough
Goodenough@sei.cmu.edu