Incomplete, private, and deferred constant homographs AI-00386/06 1 88-11-04 BI WA | !standard 08.03 (17) 88-11-04 AI-00386/06 !class binding interpretation 85-09-02 | !status approved by WG9 88-10-28 !status ARG-approved 88-05-10 (reviewed) !status ARG-approved (13-1-1) 87-09-15 (pending editorial review) !status panel-approved (5-0-1) 87-09-15 (pending editorial review) !status work-item 87-03-12 !status received 85-09-02 | !references 83-00625, 83-00702, 83-00986 !topic Incomplete, private, and deferred constant homographs !summary 87-10-29 An incomplete or private type declaration and its corresponding full or task type declaration are allowed to occur immediately within the same declarative region, even though they are homographs. Similarly, a deferred constant declaration and its corresponding full declaration are allowed to occur immediately within the same declarative region. !question 87-10-29 Consider the following declarations: type T; -- (1) type A is access T; -- T denotes declaration at (1) type T is range 1..10; -- (2) X : T; -- T should denote declaration at (2) 8.3(15) says that the declarations at (1) and (2) are homographs: both declarations have the same identifier and overloading is allowed for "at most one of the two" (in this case, for neither of the two). 8.3(17) says: Two declarations that occur immediately within the same declarative region must not be homographs, unless either or both of the following requirements are met: (a) exactly one of them is the implicit declaration of a predefined operation; (b) exactly one of them is the implicit declaration of a derived subprogram. Neither of declarations (1) and (2) is an implicit declaration, so according to the wording in 8.3(17), their occurrence together immediately within the same declarative region is illegal. However, 3.8.1(3) requires that the full type declaration (2) occur immediately within the same declarative region as its incomplete type declaration (1). Thus, 8.3(17) seems to contradict 3.8.1(3). Note that 8.3(15) defines homographs in terms of declarations, not in terms of declared entities. Hence, the fact that both declarations declare a single type is irrelevant to the wording in 8.3(17). Incomplete, private, and deferred constant homographs AI-00386/06 2 88-11-04 BI WA A similar problem applies to private type declarations and their corresponding full or task type declarations and to deferred constant declarations and their full object declarations. Shouldn't 8.3(17) permit incomplete, private, and deferred constant declarations to occur in the same declarative region as their full declarations? !recommendation 87-10-29 An incomplete or private type declaration and its corresponding full or task type declaration are allowed to occur immediately within the same declarative region. Similarly, a deferred constant declaration and its corresponding full declaration are allowed to occur immediately within the same declarative region. !discussion 88-05-03 7.4.1(2) says that a private type declaration and the corresponding full type declaration define a single type. However, 8.3(15) defines homographs in terms of declarations rather than in terms of entities: Each of two declarations is said to be a HOMOGRAPH of the other if both declarations have the same identifier and overloading is allowed for at most one of the two. ... Hence, the fact that an incomplete or private type or deferred constant declaration and its corresponding full or task type or full object declaration declare a single entity is not relevant to the wording of the rules in 8.3. Both an incomplete/private type or deferred constant declaration and a full/task type or full object declaration are declarations. By 8.3(15), both declarations are homographs. However, 3.8.1(3), 7.4.1(1), and 7.4.3(1) clearly require that these two declarations occur immediately within the same declarative region despite the rules in 8.3(17). For incomplete types, 3.8.1(3) says: If the incomplete type declaration occurs immediately within either a declarative part or the visible part of a package specification, then the full type declaration must occur later and immediately within this declarative part or visible part. If the incomplete type declaration occurs immediately within the private part of a package, then the full type declaration must occur later and immediately within either the private part itself, or the declarative part of the corresponding package body. For private types, 7.4.1(1) says: If a private type declaration is given in the visible part of a package, then a corresponding declaration of a type with the same Incomplete, private, and deferred constant homographs AI-00386/06 3 88-11-04 BI WA identifier must appear as a declarative item of the private part of the package. The corresponding declaration must be either a full type declaration or the declaration of a task type. For deferred constants 7.4.3(1) says: If a deferred constant declaration is given in the visible part of a package then a constant declaration (that is, an object declaration declaring a constant object, with an explicit initialization) with the same identifier must appear as a declarative item of the private part of the package. This object declaration is called the FULL declaration of the deferred constant. It was not intended that 8.3(17) be inconsistent with 3.8.1(3), 7.4.1(1), and 7.4.3(1).