[comp.lang.ada] Accepts in subprograms

spray@smu (08/16/87)

Does anyone know why ACCEPT statements cannot be in subprograms
within a task body (LRM 9.5(8))? I think it used to be in Ada80.

A colleague had a big FSM in a task and wanted to accept the
next input from various places, so he tried to write a procedure
GET_NEXT_ENTRY with the obvious results. He has a more conventional
reader/writers task structure now, but I still couldn't answer
"But, why not?"

Rob Spray
Electrospace Systems
...convex!smu!spray
smu%spray@relay.cs.net

colbert@hermix.UUCP (colbert) (08/21/87)

Hi Rob,

I suspect the reason you cannot put an accept statement in a procedure reflects
the problem of ownership; i.e. if I place an accept statement of an entry
in procedure, what task does this entry belong to?  Also, from the perspective
of scoping, you are required to declare a body in the same scope as its
corresponding declaration. Since the accept statement is essentially the
"body" of an entry, you must declare it in the same scope as the entry declar-
ation (e.g., the task body).

See you in Seattle!

Take Care,
Ed Colbert
hermix!colbert@rand-unix.arpa
{seismo,trwrb,...!)hermix!colbert

P.S. For any one who has tried to reach me over the net for the last year,
     I haven't had an account since I left TRW.  Thanks to Herman Fischer
     I'm back on-line.

P.S.S.	I've also moved.  My new snail mail address and phone are:

	Absolute Software Co.
	4593 Orchid Dr.
	Los Angeles, Ca 90043-3320
	(213) 293-0783