Version 1.1 of ais/ai-00399.txt

Unformatted version of ais/ai-00399.txt version 1.1
Other versions for file ais/ai-00399.txt

!standard 9.1(3)          05-01-25 AI95-00399/01
!standard 9.4(3)
!class amendment 05-01-25
!status work item 05-01-25
!status received 05-01-25
!priority High
!difficulty Easy
!subject Single task and protected objects implementing interfaces
!summary
(See proposal.)
!problem
The current syntax only allows a task or protected type to implement (one or several) interfaces. This is an unnecessary restriction: it makes perfect sense for a single task or protected object declaration to implement an interface. There is no reason to make single task or protected objects less functional than types. This is especially important if users want to take advantage of interfaces in existing code.
!proposal
(See wording.)
!wording
Change 9.1(3) to read:
single_task_declaration ::= task defining_identifier [is [new interface_list with] task_definition];
Change 9.4(3) to read:
single_protected_declaration ::= protected defining_identifier is [new interface_list with] protected_definition;
!discussion
One might naively think that, because the type of a single task or protected object is anonymous, the interface inheritance facility is not too useful. After all, there is no way to name the derived type. So this means that a subprogram inherited from some interface cannot be overridden. However, because the task or protected object is an implicit parameter of the entries and protected subprograms it declares, such an inherited subprogram can be implemented, as shown by the example below:
type Map is protected interface; procedure Put (M: Map; K : Key; V : Value);
protected My_Protected_Map is
new Map with
procedure Put (K : Key; V : Value);
end My_Protected_Map;
!example
--!corrigendum
!ACATS test
ACATS C-Test(s) should be created to insure this works.
!appendix

****************************************************************

Questions? Ask the ACAA Technical Agent