[net.lang.ada] Task entries in generics

RRACINE@ADA20.ISI.EDU (Roger Racine) (07/02/86)

Can anyone give a reason why entries are not allowed as parameters to
generics? The ability to use selective calls can sometimes be necessary
to avoid deadlocks, and making a task entry look like a procedure makes 
it impossible to use a selective call.

It would seem easy enough to add a "with entry ________" construct to
the formal part of the generic, following the same rules as for procedures.
Then any entry having the correct parameters could be used as the actual
parameter in an instance of the generic.

One reason suggested by the person who asked me about it is that the syntax
of an entry call always has the "TASK.ENTRY" form. Is there some problem
with compiler construction or readability that would make the procedure
syntax a problem? One could (if necessary) make the formal parameter
have the correct syntax ("with entry T.E"). 

There is, of course, a way around this problem. I would appreciate comments
as to whether the workaround is as distasteful to others as it is to me.
One can create a procedure which has the same parameters as the entry,
plus a parameter of type DURATION (mode "in") and an "out" parameter
of type BOOLEAN to specify whether the rendezvous occurred. This approach
works well when the entry has no "out" parameters, but forces the
procedure to put something in the parameters if they exist.

By the way, it was not possible to use an access to a task type,
because the tasks were being declared in a generic; therefore, each
instance created (necessarily for this application) a new type.
The entries needed for the generic I am trying to design were identical
(START_TASK, STOP_TASK, that kind of entry) in all instances.

If anyone has a more elegant solution, I would love to look at it.

Please send them to INFO-ADA@ADA20.ISI.EDU so that
       1) Others can see them.
       2) Others do not duplicate them.


Roger Racine
C.S. Draper Laboratory
RRACINE@ADA20.ISI.EDU
-------