Skip to content

Remove restriction from 9.7.1(12) (mutually exclusive terminate/delay/else) and rework 9.7.1(8) (at least one accept_alternative) #162

@liampwll

Description

@liampwll

Since Ada 83, section 9.7.1 has contained the following lines:

  1. A selective_accept shall contain at least one accept_alternative. In addition, it can contain:
    • a terminate_alternative (only one); or
    • one or more delay_alternatives; or
    • an else part (the reserved word else followed by a sequence_of_statements).
  2. These three possibilities are mutually exclusive.

The rationale does not present a reason for the final condition, unless I have missed it, and I can not think of any obvious reason for this restriction so I would like to propose that those lines are changed to something similar to the following:

  1. A selective_accept shall contain at least one may contain multiple accept_alternative. In addition, it can contain:
    • a terminate_alternative (only one); or
    • one or more delay_alternatives; or
    • an else part (the reserved word else followed by a sequence_of_statements).
  2. These three possibilities are not mutually exclusive.

The rationale for this change is to allow tasks to define termination points without the need for an accept alternative designed solely to terminate the task. This is especially useful for long-running tasks that perform work in a loop, for example:

task body Server is
begin
   loop
      select
         delay 1.0;
         Update_Temperature_Reading;
      or
         terminate;
      end select;
   end loop;
end Server;

Metadata

Metadata

Assignees

No one assigned

    Labels

    Feature RequestA proposal for a new language feature or capability

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions