Version 1.6 of ai12s/ai12-0121-1.txt

Unformatted version of ai12s/ai12-0121-1.txt version 1.6
Other versions for file ai12s/ai12-0121-1.txt

!standard 13.13.2(38/3)          15-01-19 AI12-0121-1/03
!class binding interpretation 14-08-11
!status Corrigendum 1-2012 14-11-13
!status WG9 Approved 15-06-26
!status ARG Approved 7-0-1 14-10-18
!status work item 14-08-11
!status received 14-06-28
!priority Medium
!difficulty Easy
!qualifier Omission
!subject Stream-oriented aspects
!summary
The stream-oriented attributes can be specified by an aspect specification, and the same legality rules apply. Class-wide attributes for interfaces can be specified as any appropriate nonabstract subprogram.
!question
13.13.2(38/3) says that the stream-oriented attributes can be specified with an attribute_definition_clause, and then it goes on to provide various legality rules for such specification. Nothing is mentioned about the rules for specification with an aspect_specification. Do the same rules apply? (Yes.)
Second, the rules prevent specifying a stream attribute for an interface as anything other than a null procedure. This applies to class-wide attributes as well as specific attributes. However, the reason for this restriction (inheritance issues) does not apply to overriding a class-wide stream attribute of an interface, since such attributes are never inherited. Should this be allowed? (Yes.)
!recommendation
(See Summary.)
!wording
Modify 13.13.2(38/3) (spliting into multiple paragraphs):
The stream-oriented attributes may be specified for any type via an attribute_definition_clause. {Redundant[Alternatively, each of the specific stream-oriented attributes may be specified using an aspect_specification on any type_declaration, with the aspect name being the corresponding attribute name.]}
[Editor's note: See the discussion as to why we only talk about specific stream attributes in the new text.]
AARM Proof: 13.1.1 says that all operational attributes can be specified with an aspect_specification.
The subprogram name given in such [a clause]{an attribute_definition_clause or aspect_specification} shall statically denote a subprogram that is not an abstract subprogram. Furthermore, if a {specific} stream-oriented attribute is specified for an interface type[ by an attribute_definition_clause], the subprogram name given in the {attribute_definition_clause or aspect_specification}[clause] shall statically denote a null procedure.
!discussion
AI12-0106-1 addresses the problem of specifying class-wide stream attributes with aspect specifications, so we do not mention specifying those as aspects in this wording change.
The reason that interfaces only allow null procedures for (specific) stream attributes is explained in AARM 13.13.2(38.b/2). In particular, stream attributes of interfaces do not participate in extensions, unless the interface is the parent type (as opposed to a progenitor type). If the interfaces could have significant attributes, then the order of declarations could be significant (which violates an important design principle of interfaces).
However, class-wide stream attributes are never used in extensions, or inherited in any other way. So it is OK to replace them; we don't need to make such overrides illegal.
!corrigendum 13.13.2(38/3)
Replace the paragraph:
The stream-oriented attributes may be specified for any type via an attribute_definition_clause. The subprogram name given in such a clause shall statically denote a subprogram that is not an abstract subprogram. Furthermore, if a stream-oriented attribute is specified for an interface type by an attribute_definition_clause, the subprogram name given in the clause shall statically denote a null procedure.
by:
The stream-oriented attributes may be specified for any type via an attribute_definition_clause. Alternatively, each of the specific stream-oriented attributes may be specified using an aspect_specification on any type_declaration other than an incomplete_type_declaration, with the aspect name being the corresponding attribute name.
The subprogram name given in such an attribute_definition_clause or aspect_specification shall statically denote a subprogram that is not an abstract subprogram. Furthermore, if a specific stream-oriented attribute is specified for an interface type, the subprogram name given in the attribute_definition_clause or aspect_specification shall statically denote a null procedure.
!ASIS
No ASIS effect.
!ACATS test
An ACATS C-Test should be constructed to verify that class-wide stream attributes of interfaces can be specified with a concrete subprogram. (It might be valuable to have a B-Test similar to BDD2005 for the purpose of checking all of the rules with Error and OK lines; then a C-Test to actually try overriding an attribute.)
!appendix

This AI was split from AI12-0106-1 during ARG meeting #51 (Paris).

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

Questions? Ask the ACAA Technical Agent