!standard 3.10.1(6) 05-02-03 AI95-00412/01 !class amendment 05-02-03 !status work item 05-02-03 !status received 05-02-03 !priority Medium !difficulty Medium !subject Subtypes of incomplete types !summary Subtype declarations are permitted when the subtype mark is that of an incomplete type provided they do not have any constraints or a null exclusion. !problem The introduction of limited with clauses and the fact that use package clauses are not permitted with a limited view can create long names which cannot be abbreviated since subtype declarations are not permitted for an incomplete type. !proposal (See summary.) !wording Add after 3.10.1(6/2) (might as well reuse 7/2 which is now empty) * as the subtype_mark in the subtype_indication of a subtype_declaration; the subtype indication shall not have a null_exclusion or a constraint; !discussion The canonical example of limited with clauses is limited with Departments; package Employees is type Employee is tagged private; procedure Assign_Employee(E: in out Employee; D: in out Departments.Department'Class); type Dept_Ptr is access all Departments.Department'Class; function Current_Department(E: Employee) return Dept_Ptr; ... end Employees; limited with Employees; package Departments is type Department is tagged private; procedure Choose_Manager(D: in out Department; M: in out Employees.Employee'Class); ... end Departments; The names Departments.Department and Employees.Employee are long and cumbersome. There are two ways of avoiding such long names in general. One is by adding use clauses and the other is by renaming (or using subtypes). In the case of limited with, use package clauses are forbidden. Moreover use package clauses are often forbidden by projects anyway. In such circumstances the use of renaming or subtypes is very useful. Thus we might have V: Float renames Aeroplane_Data.Current_Velocity; The use of meaningful package names and variable names is good practice but when put together they can be overwhelming. The renaming enables an abbreviation to be used locally but ensures that the full name is still visible to the human reader. In the case of types, renaming is not appropriate but a subtype serves an equivalent purpose thus subtype T is Long_Package_Name.Long_Type_Name; In the Employees and Departments example we would like to say subtype Dept is Departments.Department; and subtype Empl is Employees.Employee; This is currently forbidden because the name of an incomplete type is only permitted in a short list of places by 3.10.1(5/2-10/2). We therefore add that it can also be used in a subtype declaration. Clearly however, we know little about the type (except that it might be tagged) and so constraints and not null are not permitted. The only other things made visible by a limited with clause are the names of the package itself and any nested packages. Renaming is already permitted for them. !example (See discussion.) --!corrigendum 02.09(2) !ACATS test !appendix *************************************************************