!standard 3.2 (02) 05-10-25 AI95-00442/01
!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
!comment This AI is not yet approved, but is included in the Amendment.
!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), relecting 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: 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:
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 classification dimensions, but do not fit
into the above strictly hierarchical picture.
Add to the end of 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 such a type inherit
the characteristics that define that class. The
more general term *category of types* is used for a set of types
whose defining characteristics are not necessarily inherited by
derivatives; 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)
@drepl
Types are grouped into @i of types, reflecting the similarity of their
values and primitive operations. There exist several language-defined
@i 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.
@dby
Types are grouped into @i of types.There exist several language-defined
@i of types (see NOTES below), relecting the similarity of their
values and primitive operations. Most categories of types form @i 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)
@drepl
@xindent<@s9<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" @i:
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.>>
@dby
@xindent<@s9<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: 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:
abstract, incomplete, interface, limited, private, record.>>
!corrigendum 3.2(11)
@drepl
@xindent<@s9>
@dby
@xindent<@s9>
!corrigendum 3.2(13)
@drepl
@xindent<@s9>
@dby
@xindent<@s9>
!corrigendum 3.4(1)
@drepl
A @fa defines a new type (and its first subtype) whose
characteristics are @i from those of a @i.
@dby
A @fa defines a @i (and its
first subtype) whose characteristics are @i from those of a
parent type, and possibly from progenitor types.
A @i 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 such a type inherit
the characteristics that define that class. The
more general term @i is used for a set of types
whose defining characteristics are not necessarily inherited by
derivatives; limited, abstract, and interface are all
categories of types, but not classes of types.
!corrigendum 3.4(8)
@drepl
@xbullet
@dby
@xbullet
!corrigendum 12.5(1)
@drepl
A generic formal subtype can be used to pass to a generic unit a subtype
whose type is in a certain class of types.
@dby
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)
@drepl
The form of a @fa @i to which the
formal type belongs. For a @fa the reserved
words @b and @b indicate the class (see 12.5.1). For a
@fa 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 @fa
defines a discrete type, and so on.
@dby
The form of a @fa @i
to which the formal type belongs. For a @fa the
reserved words @b and @b indicate the category of types (see
12.5.1). For a @fa 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
@fa defines a discrete type, and so on.
!corrigendum 12.5(7)
@drepl
The actual type shall be in the class determined for the formal.
@dby
The actual type shall be in the category determined for the formal.
!corrigendum 12.5(8)
@drepl
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.
@dby
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)
@drepl
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.
@dby
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)
@drepl
The class determined for a formal private type is as follows:
@dby
The category determined for a formal private type is as follows:
!corrigendum 12.5.1(17)
@drepl
@i@ @tab@i@hr@hr
@b@ @tabthe class of all types@hr
@b@ @tabthe class of all nonlimited types@hr
@b@ @tabthe class of tagged types@hr
@b@ @tabthe class of all nonlimited tagged types
@dby
@i@ @tab@i@hr@hr
@b@ @tabthe category of all types@hr
@b@ @tabthe category of all nonlimited types@hr
@b@ @tabthe category of tagged types@hr
@b@ @tabthe category of all nonlimited tagged types
!corrigendum 12.5.1(24)
@drepl
@xindent<@s9<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"):>>
@dby
@xindent<@s9<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)
@drepl
A @i is one defined by any of the
@fas in this subclause. The class determined for a
formal scalar type is discrete, signed integer, modular, floating point,
ordinary fixed point, or decimal.
@dby
A @i is one defined by any of the
@fas 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)
@drepl
The class determined for a formal array type is the class of all array
types.
@dby
The category determined for a formal array type is the category of all array
types.
!corrigendum 12.5.4(1)
@drepl
The class determined for a formal access type is the class of all access
types.
@dby
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
*************************************************************