Version 1.3 of ai05s/ai05-0109-1.txt
!standard 13.13.2(34/2) 08-11-18 AI05-0109-1/02
!class binding interpretation 08-08-08
!status Amendment 201Z 08-11-26
!status ARG Approved 8-0-1 08-11-01
!status work item 08-08-08
!status received 08-05-19
!priority Low
!difficulty Easy
!qualifier Clarification
!subject Impossible check in S'Class'Input
!summary
It is not possible for the internal tag in S'Class'Input to designate something other
than a descendant of S.
!question
13.13.2(34), which describes the semantics of S'Class'Input, says:
First reads the external tag from Stream and determines the
corresponding internal tag (by calling Tags.Descendant_Tag
(String'Input(Stream), S'Tag) which might raise Tag_Error---see
3.9) and then dispatches to the subprogram denoted by the Input
attribute of the specific type identified by the internal tag;
returns that result. If the specific type identified by the
internal tag is not covered by T'Class or is abstract,
Constraint_Error is raised.
But it seems that the condition "not covered by T'Class" can never
be true, because Tags.Descendant_Tag (when called with S'Tag) is
incapable of returning the tag of a specific type that is not a
descendant of T; it would raise Tag_Error if the external tag
identified a type that wasn't a descendant.
Should this impossible text be removed? (Yes.)
!recommendation
(See summary.)
!wording
Change 13.13.2(34/2):
First reads the external tag from Stream and determines the corresponding
internal tag (by calling Tags.Descendant_Tag(String'Input(Stream), S'Tag)
which might raise Tag_Error — see 3.9) and then dispatches to the subprogram
denoted by the Input attribute of the specific type identified by the internal
tag; returns that result. If the specific type identified by the internal tag
[is not covered by T'Class or ]is abstract, Constraint_Error is raised.
AARM Note: Descendant_Tag will ensure that the returned tag is covered by T'Class.
!discussion
We remove the text as it could be confusing that a tag not covered by T'Class
raises Tag_Error rather than Constraint_Error.
!corrigendum 13.13.2(34/2)
Replace the paragraph:
First reads the external tag from Stream and determines the
corresponding internal tag (by calling
Tags.Descendant_Tag(String'Input(Stream), S'Tag) which might raise
Tag_Error — see 3.9) and then dispatches to the subprogram denoted by the
Input attribute of the specific type identified by the internal tag; returns
that result. If the specific type identified by the internal tag is not covered
by T'Class or is abstract, Constraint_Error is raised.
by:
First reads the external tag from Stream and determines the
corresponding internal tag (by calling
Tags.Descendant_Tag(String'Input(Stream), S'Tag) which might raise
Tag_Error — see 3.9) and then dispatches to the subprogram denoted by the
Input attribute of the specific type identified by the internal tag; returns
that result. If the specific type identified by the internal tag is abstract,
Constraint_Error is raised.
!ACATS Test
No test is needed, since the case in question is impossible.
!appendix
!topic Obsolete check in description of S'Class'Input?
!reference 13.13.2(34)
!from Adam Beneschan 08-05-19
!discussion
13.13.2(34), which describes the semantics of S'Class'Input, says:
First reads the external tag from Stream and determines the
corresponding internal tag (by calling Tags.Descendant_Tag
(String'Input(Stream), S'Tag) which might raise Tag_Error---see
3.9) and then dispatches to the subprogram denoted by the Input
attribute of the specific type identified by the internal tag;
returns that result. If the specific type identified by the
internal tag is not covered by T'Class or is abstract,
Constraint_Error is raised.
But it seems to me that the condition "not covered by T'Class" can never
be true, because Tags.Descendant_Tag (when called with S'Tag) is
incapable of returning the tag of a specific type that is not a
descendant of T; it would raise Tag_Error if the external tag
identified a type that wasn't a descendant.
This phrase in the RM is therefore not only redundant, it could be
confusing to a programmer who might expect that Constraint_Error
would be raised if the external tag in the stream refers to a
non-descendant type, when in reality Tag_Error is raised.
So it seems to me this part of the last sentence should be removed.
(By the way, I note that all the discussion in AI-279 on this check
came before AI-344, which changed Internal_Tag to Descendant_Tag, was
started.)
****************************************************************
Questions? Ask the ACAA Technical Agent