Version 1.1 of ai05s/ai05-0038-1.txt

Unformatted version of ai05s/ai05-0038-1.txt version 1.1
Other versions for file ai05s/ai05-0038-1.txt

!standard A.10.5(37)          07-01-22 AI05-0038-1/01
!standard A.10.7(8/1)
!standard A.10.7(10)
!standard A.10.7(12)
!class binding interpretation 07-01-12
!status work item 07-01-12
!status received 06-11-27
!priority Low
!difficulty Easy
!qualifier Omission
!subject Minor Errors in Ada.Text_IO.
(1) No call of New_Line is made if Set_Line(1) is called, and the current line number is greater than 1.
(2) procedures Look_Ahead and Get_Immediate raise Status_Error if the file is not open.
(1) According to A.10.5(37), a call of Set_Line (1) would lead to a call of New_Line (0) if the current line number is greater than 1. But that would raise Constraint_Error (Spacing has subtype Positive_Count). What is the intent?
(2) A.10.6(9) does not over Look_Ahead or Get_Immediate. But these routines have no statement that an empty file raises Status_Error. Surely that should happen for these routines.
(See Summary.)
(1) Change the last sentence of A.10.5(37) to:
If the value specified by To is less than the current line number, has the effect of calling New_Page; then if To is greater than 1, a call to New_Line with a spacing equal to (To - 1) follows.
(2) Add
Status_Error is raised if File is not open.
to A.10.7(8/1), A.10.7(10), A.10.7(12) before the sentence starting "Mode_Error is raised..."
(1) This error even appears in Ada 83. Clearly, Set_Line(1) should just call New_Page if the value of the current line is greater than 1.
(2) We could fix this two ways, either by adding the missing rule to A.10.7(8/1), A.10.7(10), and A.10.7(12), or by changing A.10.6(9).
Note that A.10.6(9) also covers Mode_Error, and it was not changed for to cover these routines, either: the rule was added to each of the routines. Thus, we conclude it was intended to specify the rule in the definition of these routines, rather than changing the blanket definition.
--!corrigendum A.18.2(239/2)
!ACATS test
Both of these changes just confirm the expected behavior (which doesn't match the wording), so there isn't a significant need for testing them.

!topic New_Line called with Spacing = 0
!reference Ada 2005 RM-A.10.5(37)
!author Christoph Grein 2006-11-27
According to A.10.5(37), a call of Set_Line (1) would lead to a call of
New_Line (0) if the current line number is greater than 1.
(This is already in RM 83 14.3.4(36) - or am I blind?)


From: Tucker Taft
Date: Monday, November 27, 2006  1:14 PM

Good point.  That wording has been around forever,
and no-one bothered to analyze it closely.
It is modeled on the "Set_Col" wording, which
can legitimately talk about outputting "To-1"
spaces even when To = 1.

On the other hand, calling "New_Line(Spacing => To-1)"
doesn't make sense for To = 1, because
Spacing is of subtype Positive.  I presume we
all "know" what it means, i.e., do nothing, but
it should probably be stated correctly.

In general, the Ada Rapporteur Group has concluded
that any time the manual says one thing
is equivalent to something else (or in this case,
"has the effect of calling..."), it is probably
telling a lie (sometimes a small lie, sometimes a
big one).


!topic No statement for Get_Immediate, Look_Ahead, when the file is not open.
!reference Ada 2005 RM-A.10.7(8/1,10,12)
!author Christoph Grein 2006-12-01
This is a very minor point, but contrary to all other file operations,
the paragraphs about Get_Immediate and Look_Ahead do not state what
should happen if the file is not open.
RM-A.10.6(9) does not apply.


Questions? Ask the ACAA Technical Agent