!standard 5.1(2) 10-04-05 AI05-0179-1/04 !class Amendment 09-10-29 !status Amendment 2012 10-04-05 !status ARG Approved 10-0-0 10-02-26 !status work item 09-10-29 !status received 09-10-29 !status received !priority Low !difficulty Easy !subject Labels at end of a sequence_of_statements !summary A label is allowed at the end of a sequence_of_statements. !problem One of the most common uses of gotos in Ada is to "continue" a loop. That is, complete the current iteration and go on to the next one. Nearly 25% of the gotos in the GNAT compiler are for this purpose. This looks something like: loop ... goto Continue; -- Usually deeply nested. ... <> null; end loop; The "null;" here is just noise. We're going to the end of the construct. But we need the "null;" since a label is not allowed at the end of a sequence_of_statements. Intuitively, a label marks a "place" in a sequence of statements; it doesn't mark a particular statement. When you "goto" to a label, you start executing at that place and continue on with all the rest of the statements. Therefore, it makes perfect sense to have a label after the last statement in a sequence; the "null;" adds no benefit at all; it should be eliminated (especially as a large percentage of uses of labels are currently saddled with this noise). !proposal (See summary.) !wording Modify 5.1(2) to: sequence_of_statements ::= statement {statement} {label} Add after 5.1(12): (Static semantics) If one or more labels end a sequence_of_statements, an implicit null_statement follows the labels before any following constructs. !discussion It is odd indeed that a label can *start* a sequence of statements, but it cannot *end* a sequence of statements. There is no practical difference in readability. We define such a label as being followed by an implicit null_statement so that the formal semantics of a goto_statement is preserved (which transfers control to a statement, not to the label itself). Changing that semantics to something more consistent with the intuitive model mentioned in the !problem was considered, but seemed to have much more wording change than required for such a simple change to the language. We retain the requirement that a sequence of statements include at least one statement (a label all by itself is still not allowed). So the following is allowed by this proposal: if A then null; <> end if; But the following is still illegal: if A then <> -- Illegal end if; And the following is still legal (of course): if A then <> null; end if; !example loop ... goto Continue; -- Usually deeply nested. ... <> end loop; !corrigendum 5.1(2) @drepl @xcode @dby @xcode !corrigendum 5.1(12) @dinsa For each @fa, there is an implicit declaration (with the specified @fa) at the end of the @fa of the innermost @fa or body that encloses the @fa. The implicit declarations occur in the same order as the @fas occur in the source text. If a usage name denotes such an implicit declaration, the entity it denotes is the @fa