Version 1.4 of ais/ai-00442.txt

Unformatted version of ais/ai-00442.txt version 1.4
Other versions for file ais/ai-00442.txt

!standard 3.2 (02)          06-02-24 AI95-00442/03
!standard 3.2 (10)
!standard 3.2 (11)
!standard 3.2 (13)
!standard 3.4 (01)
!standard 3.4 (08)
!standard 12.5 (01)
!standard 12.5 (06)
!standard 12.5 (07)
!standard 12.5 (08)
!standard 12.5.1 (01)
!standard 12.5.2 (01)
!standard 12.5.3 (01)
!standard 12.5.4 (01)
!standard 12.5.5 (01)
!class amendment 05-10-25
!status Amendment 200Y 05-10-25
!status WG9 Approved 06-06-09
!status ARG Approved 5-0-3 05-11-19
!status work item 05-10-25
!status received 05-10-24
!priority High
!difficulty Medium
!subject Classes and categories of types
!summary
Not all categories of types are a class of types. What categories form classes are spelled out.
!problem
3.4(8) says that "each class of types" also includes a derived type. Thus, a class is closed under derivation. But what properties of types form classes and which don't? The Notes and AARM notes in 3.2 make it clear that some properties don't form classes (like "limited" and "interface"). But there seems to be no normative rule that says that "array" (to take one example) is a property that forms a class.
In addition, "class" is used informally to represent sets of types that do not form classes that are closed under derivation (most notably, in 12.5 and it's subclauses). This is unnecessarily confusing.
!recommendation
We define the more general "categories of types" to avoid confusion from using class informally for sets of types that are not closed under derivation.
We explicitly specify the categories that form "classes of types" in 3.4(8).
Note that this wording assumes that AIs 233, 251, 345, 401, and 419 are included in the Amendment.
!wording
Change the first part of 3.2(2) to:
Types are grouped into categories of types. There exist several language-defined categories of types (see NOTES below), reflecting the similarity of their values and primitive operations. Most categories of types form classes of types.
Change 3.2(10) to:
2 Any set of types can be called a "category" of types, and any set of types that is closed under derivation (see 3.4) can be called a "class" of types. However, only certain categories and classes are used in the description of the rules of the language - generally those that have their own particular set of primitive operations (see 3.2.3), or that correspond to a set of types that are matched by a given kind of generic formal type (see 12.5). The following are examples of "interesting" @i<language-defined classes>: elementary, scalar, discrete, enumeration, character, boolean, integer, signed integer, modular, real, floating point, fixed point, ordinary fixed point, decimal fixed point, numeric, access, access-to-object, access-to-subprogram, composite, array, string, (untagged) record, tagged, task, protected, nonlimited. Special syntax is provided to define types in each of these classes. In addition to these classes, the following are examples of "interesting" @i<language-defined categories>: abstract, incomplete, interface, limited, private, record.>>
Change 3.2(11) to:
These language-defined categories are organized like this:
Change 3.2(13) to:
There are other categories, such as "numeric" and "discriminated", which represent other categorization dimensions, but do not fit into the above strictly hierarchical picture.
Add a new paragraph after 3.4(1):
A class of types is a set of types that is closed under derivation; that is, if the parent or a progenitor type of a derived type belongs to a class, then so does the derived type. By saying that a particular group of types forms a class, we are saying that all derivatives of a type in the set inherit the characteristics that define that set. The more general term category of types is used for a set of types whose defining characteristics are not necessarily inherited by derivatives; for example, limited, abstract, and interface are all categories of types, but not classes of types.
Change 3.4(8) to:
* Redundant:[If the parent type or a progenitor type belongs to a class of types, then the derived type also belongs to that class.] The following sets of types, as well as any higher-level sets composed from them, are classes in this sense, Redundant:[and hence the characteristics defining these classes are inherited by derived types from their parent or progenitor types]: signed integer, modular integer, ordinary fixed, decimal fixed, floating point, enumeration, boolean, character, access-to-constant, general access-to-variable, pool-specific access-to-variable, access-to-subprogram, array, string, non-array composite, nonlimited, untagged record, tagged, task, protected, and synchronized tagged.
Change 12.5(1) to:
A generic formal subtype can be used to pass to a generic unit a subtype whose type is in a certain category of types.
Change 12.5(6) to:
The form of a formal_type_definition determines a category (of types) to which the formal type belongs. For a formal_private_type_definition the reserved words tagged and limited indicate the category of types (see 12.5.1). For a formal_derived_type_definition the category of types is the derivation class rooted at the ancestor type. For other formal types, the name of the syntactic category indicates the category of types; a formal_discrete_type_definition defines a discrete type, and so on.
Change 12.5(7) to:
The actual type shall be in the category determined for the formal.
Change the first two sentences of 12.5(8) to:
The formal type also belongs to each category that contains the determined category. The primitive subprograms of the type are as for any type in the determined category.
Change 12.5.1(1) to:
In its most general form, the category determined for a formal private type is all types, but it can be restricted to only nonlimited types or to only tagged types. The category determined for a formal derived type is the derivation class rooted at the ancestor type.
Replace "class" by "category" in 12.5.1(16), 12.5.1(17), and 12.5.1(24).
Change 12.5.2(1) to:
A formal scalar type is one defined by any of the formal_type_definitions in this subclause. The category determined for a formal scalar type is the category of all discrete, signed integer, modular, floating point, ordinary fixed point, or decimal types.
Change 12.5.3(1) to:
The category determined for a formal array type is the category of all array types.
Change 12.5.4(1) to:
The category determined for a formal access type is the category of all access types.
Change 12.5.5(1) [the first rule from AI-251] to:
The category determined for a formal interface type is the category of all interface types.
Delete 12.5.5(3) [the first legality rule from AI-251]
!discussion
There is a list of properties that are classes given in the notes 3.2(10-13), but of course these aren't normative.
The change in the wording in 3.2(2) means that all of the following text is talking about categories, not classes. That means that the notes that try to explain that some things aren't classes aren't needed here.
However, we do leave 3.2(10-13) because moving them would be disruptive and confusing. We do adjust the wording to use "category" where appropriate, and update the AARM notes.
3.2(10.d) is not true, in that "limited" is not closed under derivation in Ada 2005. (Limited interfaces can be inherited by nonlimited types.) We fold this into the general discussion of categories that aren't classes.
!corrigendum 3.2(2)
Replace the paragraph:
Types are grouped into classes of types, reflecting the similarity of their values and primitive operations. There exist several language-defined classes of types (see NOTES below). Elementary types are those whose values are logically indivisible; composite types are those whose values are composed of component values.
by:
Types are grouped into categories of types. There exist several language-defined categories of types (see NOTES below), reflecting the similarity of their values and primitive operations. Most categories of types form classes of types. Elementary types are those whose values are logically indivisible; composite types are those whose values are composed of component values.
!corrigendum 3.2(10)
Replace the paragraph:
2 Any set of types that is closed under derivation (see 3.4) can be called a "class" of types. However, only certain classes are used in the description of the rules of the language — generally those that have their own particular set of primitive operations (see 3.2.3), or that correspond to a set of types that are matched by a given kind of generic formal type (see 12.5). The following are examples of "interesting" language-defined classes: elementary, scalar, discrete, enumeration, character, boolean, integer, signed integer, modular, real, floating point, fixed point, ordinary fixed point, decimal fixed point, numeric, access, access-to-object, access-to-subprogram, composite, array, string, (untagged) record, tagged, task, protected, nonlimited. Special syntax is provided to define types in each of these classes.
by:
2 Any set of types can be called a "category" of types, and any set of types that is closed under derivation (see 3.4) can be called a "class" of types. However, only certain categories and classes are used in the description of the rules of the language — generally those that have their own particular set of primitive operations (see 3.2.3), or that correspond to a set of types that are matched by a given kind of generic formal type (see 12.5). The following are examples of "interesting" language-defined classes: elementary, scalar, discrete, enumeration, character, boolean, integer, signed integer, modular, real, floating point, fixed point, ordinary fixed point, decimal fixed point, numeric, access, access-to-object, access-to-subprogram, composite, array, string, (untagged) record, tagged, task, protected, nonlimited. Special syntax is provided to define types in each of these classes. In addition to these classes, the following are examples of "interesting" language-defined categories: abstract, incomplete, interface, limited, private, record.
!corrigendum 3.2(11)
Replace the paragraph:
These language-defined classes are organized like this:
by:
These language-defined categories are organized like this:
!corrigendum 3.2(13)
Replace the paragraph:
The classes "numeric" and "nonlimited" represent other classification dimensions and do not fit into the above strictly hierarchical picture.
by:
There are other categories, such as "numeric" and "discriminated", which represent other categorization dimensions, but do not fit into the above strictly hierarchical picture.
!corrigendum 3.4(1)
Replace the paragraph:
A derived_type_definition defines a new type (and its first subtype) whose characteristics are derived from those of a parent type.
by:
A derived_type_definition defines a derived type (and its first subtype) whose characteristics are derived from those of a parent type, and possibly from progenitor types.
A class of types is a set of types that is closed under derivation; that is, if the parent or a progenitor type of a derived type belongs to a class, then so does the derived type. By saying that a particular group of types forms a class, we are saying that all derivatives of a type in the set inherit the characteristics that define that set. The more general term category of types is used for a set of types whose defining characteristics are not necessarily inherited by derivatives; for example, limited, abstract, and interface are all categories of types, but not classes of types.
!corrigendum 3.4(8)
Replace the paragraph:
by:
!corrigendum 12.5(1)
Replace the paragraph:
A generic formal subtype can be used to pass to a generic unit a subtype whose type is in a certain class of types.
by:
A generic formal subtype can be used to pass to a generic unit a subtype whose type is in a certain category of types.
!corrigendum 12.5(6)
Replace the paragraph:
The form of a formal_type_definition determines a class to which the formal type belongs. For a formal_private_type_definition the reserved words tagged and limited indicate the class (see 12.5.1). For a formal_derived_type_definition the class is the derivation class rooted at the ancestor type. For other formal types, the name of the syntactic category indicates the class; a formal_discrete_type_definition defines a discrete type, and so on.
by:
The form of a formal_type_definition determines a category (of types) to which the formal type belongs. For a formal_private_type_definition the reserved words tagged and limited indicate the category of types (see 12.5.1). For a formal_derived_type_definition the category of types is the derivation class rooted at the ancestor type. For other formal types, the name of the syntactic category indicates the category of types; a formal_discrete_type_definition defines a discrete type, and so on.
!corrigendum 12.5(7)
Replace the paragraph:
The actual type shall be in the class determined for the formal.
by:
The actual type shall be in the category determined for the formal.
!corrigendum 12.5(8)
Replace the paragraph:
The formal type also belongs to each class that contains the determined class. The primitive subprograms of the type are as for any type in the determined class. For a formal type other than a formal derived type, these are the predefined operators of the type. For an elementary formal type, the predefined operators are implicitly declared immediately after the declaration of the formal type. For a composite formal type, the predefined operators are implicitly declared either immediately after the declaration of the formal type, or later in its immediate scope according to the rules of 7.3.1. In an instance, the copy of such an implicit declaration declares a view of the predefined operator of the actual type, even if this operator has been overridden for the actual type. The rules specific to formal derived types are given in 12.5.1.
by:
The formal type also belongs to each category that contains the determined category. The primitive subprograms of the type are as for any type in the determined category. For a formal type other than a formal derived type, these are the predefined operators of the type. For an elementary formal type, the predefined operators are implicitly declared immediately after the declaration of the formal type. For a composite formal type, the predefined operators are implicitly declared either immediately after the declaration of the formal type, or later immediately within the declarative region in which the type is declared according to the rules of 7.3.1. In an instance, the copy of such an implicit declaration declares a view of the predefined operator of the actual type, even if this operator has been overridden for the actual type. The rules specific to formal derived types are given in 12.5.1.
!corrigendum 12.5.1(1)
Replace the paragraph:
The class determined for a formal private type can be either limited or nonlimited, and either tagged or untagged; no more specific class is known for such a type. The class determined for a formal derived type is the derivation class rooted at the ancestor type.
by:
In its most general form, the category determined for a formal private type is all types, but it can be restricted to only nonlimited types or to only tagged types. The category determined for a formal derived type is the derivation class rooted at the ancestor type.
!corrigendum 12.5.1(16)
Replace the paragraph:
The class determined for a formal private type is as follows:
by:
The category determined for a formal private type is as follows:
!corrigendum 12.5.1(17)
Replace the paragraph:
Type Definition
  Determined Class

limited private  the class of all types
private  the class of all nonlimited types
tagged limited private  the class of tagged types
tagged private  the class of all nonlimited tagged types
by:
Type Definition
  Determined Category

limited private  the category of all types
private  the category of all nonlimited types
tagged limited private  the category of all tagged types
tagged private  the category of all nonlimited tagged types
!corrigendum 12.5.1(24)
Replace the paragraph:
9 In accordance with the general rule that the actual type shall belong to the class determined for the formal (see 12.5, "Formal Types"):
by:
9 In accordance with the general rule that the actual type shall belong to the category determined for the formal (see 12.5, "Formal Types"):
!corrigendum 12.5.2(1)
Replace the paragraph:
A formal scalar type is one defined by any of the formal_type_definitions in this subclause. The class determined for a formal scalar type is discrete, signed integer, modular, floating point, ordinary fixed point, or decimal.
by:
A formal scalar type is one defined by any of the formal_type_definitions in this subclause. The category determined for a formal scalar type is the category of all discrete, signed integer, modular, floating point, ordinary fixed point, or decimal types.
!corrigendum 12.5.3(1)
Replace the paragraph:
The class determined for a formal array type is the class of all array types.
by:
The category determined for a formal array type is the category of all array types.
!corrigendum 12.5.4(1)
Replace the paragraph:
The class determined for a formal access type is the class of all access types.
by:
The category determined for a formal access type is the category of all access types.
!corrigendum 12.5.5(1)
!comment Dummy to force a conflict.
@dinsc Category of interface types.
!ACATS test
This is just a series of wording changes; no tests should need changes.
!appendix

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


Questions? Ask the ACAA Technical Agent