Version 1.11 of ai12s/ai12-0183-1.txt

Unformatted version of ai12s/ai12-0183-1.txt version 1.11
Other versions for file ai12s/ai12-0183-1.txt

!standard 3.7.2(3/3)          18-06-28 AI12-0183-1/06
!standard 4.9(2)
!standard 5.5.2(5/5)
!standard 8.3(12.3/2)
!standard 12.6(8.2/2)
!standard D.4(4)
!standard D.4(7/5)
!standard E.4(17)
!class presentation 16-03-23
!status Amendment 1-2012 16-03-23
!status ARG Approved 11-0-1 18-06-22
!status work item 16-03-23
!status received 16-03-23
!priority Low
!difficulty Easy
!qualifier Omission
!subject Presentation errors in Ada 2012 post Corrigendum 1
!summary
This AI corrects minor errors in the Standard.
1) Add Ordered_FIFO_Queuing to D.4(4).
2) Be specific about which policy is defined in 9.5.3 and 9.7.1.
3) The header "Static Semantics" is missing from 4.9.
4) Define the type of the object Constrained attribute in 3.7.2.
5) Drop the redundant words in 5.5.2(5/5).
6) Clarify 8.3(12.3/2) as conformance applies to profiles, not subprograms.
7) E.4(17) ought to reference 9.5, not 9.5.1.
8) 12.6(8.2/2) should say subprogram rather than object.
!question
1) AI12-0163-1 defines policy Ordered_FIFO_Queuing. But the Legality Rule D.4(4) does not allow that as a policy name. Should it? (Yes.)
2) D.4(7/5) says "The rules for this policy are specified in 9.5.3 and 9.7.1." This paragraph defines three queuing policies. "This" in this text refers to that last one mentioned (I think), but that's ambiguious. Should we be specific here? (Yes.)
3) 4.9 does not have a Static Semantics portion; the entire section though paragraph 32 is not under any header (which represents introductory text). Only paragraph 1 appears to be introductory, should there be a Static Semantics portion in this subclause? (Yes.)
4) 3.7.2(3/3) says that the result of A'Constrained is either True or False, but it never gives the type of the attribute. Compare to T'Callable, which explicitly says that the type of the attribute is Boolean. Should this be fixed? (Yes.)
5) 5.5.2(5/5) starts:
"The subtype defined by the loop_parameter_subtype_indication, if any, of a
generalized iterator component iterator shall statically match ..."
There's no such thing as a "generalized iterator component iterator". Was just "generalized iterator" meant here? (Yes.)
6) 8.3(12.3/2) says that "they fully conform", but full conformance applies to profiles, not subprograms. Should this wording be clarified? (Yes.)
7) E.4(17) says "All forms of remote subprogram calls are potentially blocking operations (see 9.5.1)." But The definition of "potentially blocking" was moved to 9.5. The reference ought to be changed, right? (Yes.)
8) 12.6(8.2/2) starts:
* if the actual matching the formal_subprogram_declaration denotes a generic formal object of another generic unit G ...
But a formal object never matches a formal subprogram. Is this supposed to say "subprogram" rather than "object"? (Yes.)
!recommendation
(See Summary.)
!wording
[Editor's note: The following changes are included in the draft RM, even though it is not intended for the full ARG to take up this AI until just before the next document (a Revision?) is submitted to WG 9. This AI is only used to record wording changes that appear to the editor to be obvious improvements in the Standard.]
1) Modify D.4(4):
The policy_identifier shall be either FIFO_Queuing, {Ordered_FIFO_Queuing, }Priority_Queuing or an implementation-defined identifier.
2) Modify D.4(7/5) [as modified by AI12-0163]:
Three queuing policies, FIFO_Queuing, Ordered_FIFO_Queuing, and Priority_Queuing, are language defined. If no Queuing_Policy pragma applies to any of the program units comprising the partition, the queuing policy for that partition is FIFO_Queuing. The rules for {the FIFO_Queuing}[this] policy are specified in 9.5.3 and 9.7.1.
3) Add a "Static Semantics" header before 4.9(2).
4) Add to the end of 3.7.2(3/3):
The value of this attribute is of the predefined type Boolean.
5) Modify 5.5.2(5/5):
The subtype defined by the loop_parameter_subtype_indication, if any, of a generalized iterator [component iterator] shall statically match ...
6) Modify 8.3(12.3/2):
* Otherwise (all are null procedures, abstract subprograms, or require overriding), then any null procedure overrides all abstract subprograms and all subprograms that require overriding; if more than one such homograph remains that is not thus overridden, then if {the profiles of the remaining homographs}[they] are all fully conformant with one another, one is chosen arbitrarily; if not, they are all hidden from all visibility.
7) Modify E.4(17):
All forms of remote subprogram calls are potentially blocking operations (see {9.5}[9.5.1]).
8) Modify 12.6(8.2/2):
* if the actual matching the formal_subprogram_declaration denotes a generic formal {subprogram}[object] of another generic unit G, and the instantiation containing the actual [that] occurs within the body of a generic unit G or within the body of a generic unit declared within the declarative region of the generic unit G, then the corresponding parameter or result type of the formal subprogram of G shall have a null_exclusion;
!discussion
1) This is a clear omission from AI12-0163-1. Obviously, if we define a queuing policy, we have to allow it to be used in the Queuing_Policy pragma, else it would be the most useless Ada construct ever.
2) The other two queuing policies are defined in this subclause, so it's fairly obvious that "this" must refer to FIFO_Queuing. But it shouldn't be necessary to read the entire subclause in order to figure that out.
3) 4.9(2-32) are not introductory text, so they should be in some headed portion. Static Semantics seems appropriate for these rules. [Editor's note: The section was labeled Intro in the RM source files (.MSS) - separately from paragraph 1. This almost certainly was a cut-and-paste error where someone forgot to change the label in the @begin and @end.]
4) The type of this attribute has been missing since the earliest versions of Ada 9x (the author checked back to version 2.0 - which was the first version to have complete wording). Interestingly, the sentence giving the type was in the Ada 83 wording, so it was presumably lost in transcription.
The odd thing is that no one ever reported the mistake until 2017; that was just short of 24 years since it was made (version 2.0 was dated March 29, 1993). That shows the difficulty of noting errors of omission.
We treat this as a presentation issue, as the results of "True" and "False" imply type Boolean as there is no other language-defined type with those literals, and it doesn't make sense for any user-defined type that happens to be around to be used as the result type of a language-defined attribute.
5) There are three kinds of iterators defined in 5.5.2, "generalized iterators", "array component iterators", and "container element iterators". Each sentence in 5.5.2(5/5) gives a rule for one kind of these iterators, so it is clear that there are extra words in the first sentence - especially as no kind of iterator includes the word "iterator" twice.
6) It's clear that "fully conform" applies to the profile of the subprograms involved, so we just change the working to say that. [Note: The question comes from the discussion of AI12-0064-2 during the Lexington ARG meeting in October 2017.]
7) The reference clearly ought to be corrected.
8) This is clearly a cut-and-paste error; there is a very similar rule in 12.4 for formal objects and it appears too much was copied. There'd be no reason for a rule that starts "if False then", so we conclude that "subprogram" had to be intended. A respondent noted that there is also an extra "that" in the paragraph.
!corrigendum 3.7.2(3)
Replace the paragraph:
A'Constrained
Yields the value True if A denotes a constant, a value, a tagged object, or a constrained variable, and False otherwise.
by:
A'Constrained
Yields the value True if A denotes a constant, a value, a tagged object, or a constrained variable, and False otherwise. The value of this attribute is of the predefined type Boolean.
!corrigendum 4.9(2)
Replace the paragraph:
A static expression is a scalar or string expression that is one of the following:
by:
Static Semantics
A static expression is a scalar or string expression that is one of the following:
!corrigendum 5.5.2(5/5)
Replace the paragraph:
The subtype defined by the loop_parameter_subtype_indication, if any, of a generalized iterator component iterator shall statically match the iteration cursor subtype. The subtype defined by the loop_parameter_subtype_indication, if any, of an array component iterator shall statically match the component subtype of the type of the iterable_name. The subtype defined by the loop_parameter_subtype_indication, if any, of a container element iterator shall statically match the default element subtype for the type of the iterable_name.
by:
The subtype defined by the loop_parameter_subtype_indication, if any, of a generalized iterator shall statically match the iteration cursor subtype. The subtype defined by the loop_parameter_subtype_indication, if any, of an array component iterator shall statically match the component subtype of the type of the iterable_name. The subtype defined by the loop_parameter_subtype_indication, if any, of a container element iterator shall statically match the default element subtype for the type of the iterable_name.
!corrigendum 8.3(12.3/3)
Replace the paragraph:
by:
!corrigendum 12.6(8.2/2)
Replace the paragraph:
by:
!corrigendum D.4(4)
Replace the paragraph:
The policy_identifier shall be either FIFO_Queuing, Priority_Queuing or an implementation-defined identifier.
by:
The policy_identifier shall be either FIFO_Queuing, Ordered_FIFO_Queuing, Priority_Queuing or an implementation-defined identifier.
!corrigendum D.4(7/5)
Replace the paragraph:
Three queuing policies, FIFO_Queuing, Ordered_FIFO_Queuing, and Priority_Queuing, are language defined. If no Queuing_Policy pragma applies to any of the program units comprising the partition, the queuing policy for that partition is FIFO_Queuing. The rules for this policy are specified in 9.5.3 and 9.7.1.
by:
Three queuing policies, FIFO_Queuing, Ordered_FIFO_Queuing, and Priority_Queuing, are language defined. If no Queuing_Policy pragma applies to any of the program units comprising the partition, the queuing policy for that partition is FIFO_Queuing. The rules for the FIFO_Queuing policy are specified in 9.5.3 and 9.7.1.
!corrigendum E.4(17)
Replace the paragraph:
All forms of remote subprogram calls are potentially blocking operations (see 9.5.1).
by:
All forms of remote subprogram calls are potentially blocking operations (see 9.5).
!ASIS
No changes needed.
!ACATS test
No test needed.
!appendix

From: Randy Brukardt
Sent: Friday, February 10, 2017  5:55 PM

In researching a suggestion from Tucker, I happened to notice that 3.7.2(3/3)
does not give any type for the attribute Constrained. The text gives the
results as True and False, but no type. Contrast to 'Callable, for instance:

A'Constrained
Yields the value True if A denotes a constant, a value, a tagged object, or a
constrained variable, and False otherwise. 

T'Callable
Yields the value True when the task denoted by T is callable, and False
otherwise; a task is callable unless it is completed or abnormal. The value
of this attribute is of the predefined type Boolean.

We need the second sentence in A'Constrained.

In the absence of an objection, I'll put this into the presentation AI.

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

From: Jeff Cousins
Sent: Saturday, February 11, 2017  3:24 AM

OK

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

From: Tucker Taft
Sent: Monday, April 24, 2017  5:05 PM

Paragraph 5/5 of 5.5.2 (Generalized Loop Iteration) seems to have a typo in
its first sentence:

   "The subtype defined by the loop_parameter_subtype_indication, if any, of a
    generalized iterator component iterator shall statically match the
    iteration cursor subtype. ..."

I think "component iterator" should be deleted leaving "... of a generalized
iterator shall statically match ...".

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

From: Randy Brukardt
Sent: Monday, April 24, 2017  10:46 PM

This looks like the kind of typo that I'd introduce in editing the RM. But it
isn't: it's present in EVERY version of AI12-0156-1 (and probably in
AI12-0151-1, which it was split from, before that). How in the world did no
one notice that duplication in 2 years of ARG discussion and review???

Anyway, since it's in the original AI, I've put the correction into the
current presentation AI [AI12-0183-1] (it's an obvious typo, since there are
three kinds of iterators defined in this clause, and none of them have two
occurrences of the word "iterator"!), and immediately made the correction (as
is the usual policy for presentation changes). [We'll vote on that AI
someday, but there's no rush.]

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

From: Randy Brukardt
Sent: Friday, June 8, 2018  10:48 PM

12.6(8.1/2 and 8.2/2) say:

For a parameter or result subtype of a formal_subprogram_declaration that has 
an explicit null_exclusion:

* if the actual matching the formal_subprogram_declaration denotes a generic 
  formal object of another generic unit G, and the instantiation containing
  the actual that occurs within the body of a generic unit G or within the 
  body of a generic unit declared within the declarative region of the generic
  unit G, then the corresponding parameter or result type of the formal 
  subprogram of G shall have a null_exclusion;

---

What generic formal object is being talked about here? I thought that the 
actual of a formal subprogram had to be a subprogram (duh!).

I note this wording is very similar to the wording for formal objects, so 
perhaps the use of "object" here is just a cut-and-paste error. But it goes
back to the original Ada 2005 AI (AI95-00423-01) and thus no one has 
questioned it for 12+ years. (It's conceivable that no one ever tried to 
implement this rule, as there is no ACATS test and it would be easy to forget
about. I was working toward ensuring that neither statement is true, but got 
hung up on this wording.)

My guess, therefore is that "object" should be "subprogram" in this wording; 
that would make a lot more sense. Agree or disagree??

Assuming no one disagrees, I'll just stick this into the presentation AI, 
since it *seems* like an obvious cut-and-paste bug. (But I wanted to check
if others agree.)

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

From: Tucker Taft
Sent: Saturday, June 9, 2018  2:46 PM

> 12.6(8.1/2 and 8.2/2) say:
> 
> For a parameter or result subtype of a formal_subprogram_declaration 
> that has an explicit null_exclusion:
> 
> * if the actual matching the formal_subprogram_declaration denotes a 
> generic formal object of another generic unit G, and the instantiation 
> containing the actual that occurs within the body of a generic unit G 
> or within the
                     ^^^^^^^^^
This sentence is not only long, but seems to have an extra "that".

> body of a generic unit declared within the declarative region of the 
> generic unit G, then the corresponding parameter or result type of the 
> formal subprogram of G shall have a null_exclusion;
> 
> ---
> 
> What generic formal object is being talked about here? I thought that 
> the actual of a formal subprogram had to be a subprogram (duh!).
> 
> I note this wording is very similar to the wording for formal objects, 
> so perhaps the use of "object" here is just a cut-and-paste error. But 
> it goes back to the original Ada 2005 AI (AI95-00423-01) and thus no 
> one has questioned it for 12+ years. (It's conceivable that no one 
> ever tried to implement this rule, as there is no ACATS test and it 
> would be easy to forget about. I was working toward ensuring that 
> neither statement is true, but got hung up on this wording.)
> 
> My guess, therefore is that "object" should be "subprogram" in this 
> wording; that would make a lot more sense. Agree or disagree??

Agree.  The last sentence of the above quote refers to "the formal subprogram
of G" so that clearly indicates that the earlier reference should have said
"... denotes a generic formal subprogram of another generic unit G, ..."

Also, as mentioned above, I believe the sentence has an extra "that."  Hence, 
I believe it should be:

  * if the actual matching the formal_subprogram_declaration denotes a generic
    formal subprogram of another generic unit G, and the instantiation containing
    the actual occurs within the body of a generic unit G or within the
    body of a generic unit declared within the declarative region of the generic
    unit G, then the corresponding parameter or result type of the formal
    subprogram of G shall have a null_exclusion;

> Assuming no one disagrees, I'll just stick this into the presentation 
> AI, since it *seems* like an obvious cut-and-paste bug. (But I wanted 
> to check if others agree.)

Make sense.

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


Questions? Ask the ACAA Technical Agent