Annotated Ada Reference Manual (Ada 202y Draft 1)Legal Information
Contents   Index   References   Search   Previous   Next 

12.5.5 Formal Interface Types

1/2
{AI95-00251-01} {AI95-00442-01} [The category determined for a formal interface type is the category of all interface types.] 
1.a/2
Proof: {AI95-00442-01} This rule follows from the rule in 12.5 that says that the category is determined by the one given in the name of the syntax production. The effect of the rule is repeated here to give a capsule summary of what this subclause is about. 
1.b/2
Ramification: Here we're taking advantage of our switch in terminology from “determined class” to “determined category”; by saying “category” rather than “class”, we require that any actual type be an interface type, not just some type derived from an interface type. 

Syntax

2/2
{AI95-00251-01} formal_interface_type_definition ::= interface_type_definition

Legality Rules

3/2
{AI95-00251} {AI95-00401} The actual type shall be a descendant of every progenitor of the formal type.
4/2
{AI95-00345} The actual type shall be a limited, task, protected, or synchronized interface if and only if the formal type is also, respectively, a limited, task, protected, or synchronized interface. 
4.a/2
Discussion: We require the kind of interface type to match exactly because without that it is almost impossible to properly implement the interface. 

Examples

5/5
{AI12-0429-1} {AI12-0442-1} Example of the use of a generic with a formal interface type, to establish a standard interface that all tasks will implement so they can be managed appropriately by an application-specific scheduler: 
6/2
{AI95-00433-01} type Root_Work_Item is tagged private;
7/2
{AI95-00433-01} generic
   type Managed_Task is task interface;
   type Work_Item(<>) is new Root_Work_Item with private;
package Server_Manager is
   task type Server is new Managed_Task with
      entry Start(Data : in out Work_Item);
   end Server;
end Server_Manager;

Extensions to Ada 95

8.a/2
{AI95-00251-01} {AI95-00345-01} {AI95-00401-01} {AI95-00442-01} The formal interface type is new. 

Contents   Index   References   Search   Previous   Next 
Ada-Europe Ada 2005 and 2012 Editions sponsored in part by Ada-Europe