!standard 3.3.1(31/2) 21-05-28 AI12-0430-1/02 !standard 3.6.1(13) !standard 3.8(27) !standard 3.8.1(25) !standard 4.3.5(62/5) !standard 4.3.5(92/5) !standard 4.3.5(93/5) !standard 9.4(31) !standard H.7.1(0) !class presentation 21-05-24 !status Amendment 1-2012 21-05-24 !status ARG Approved 15-0-0 21-06-03 !status work item 21-05-24 !status received 20-05-24 !priority Low !difficulty Easy !qualifier Omission !subject Example issues from WG 9 review !summary Various issues with examples were noted by WG 9 reviewers of Draft 29 of the RM. !question We need to fix issues noted in the examples, right? (Yes.) !recommendation (See summary.) !wording [Editor's note: These changes were applied to Draft 30 of the RM, even though they wereare not yet approved.] In 3.3.1(31/2) add "-- see 3.6" for Bit_Vector. In 3.6.1(13) add "-- see 3.6" for Bit_Vector. In 3.8 (27) add "-- see 3.5.1" for Month_Name. In 3.8.1(25), properly align "end case" and "end record". [Note: This was copied incorrectly from the Ada 83 RM, and is wrong in all versions of Ada since, starting with Ada 9x 2.0 (the first version with examples) and continuing to the present.] In 4.3.5(62/5), replace Count_Type with Integer. Delete 4.3.5(92/5) and 4.3.5(93/5). [Editor's note: These examples are illegal as written as the Map_Type they use does not declare iterators. Doing that would require four new aspects and three new subprograms, which is quite complex and would obscure (further) the point of this example. Perhaps there is some other type in the RM that could be used, or maybe an example container type should be declared somewhere else (perhaps in 5.5.2) for this purpose. That sort of major example change is deferred to a future language update.] In 4.5.8(12/3), modify "... a positive number {N} is composite ..." In 9.4(31), "return" and "others" should be bold. Add after H.7.1(17/5): Examples An example of use of the Dispatching aspect: procedure My_Write( -- see 13.13.2 Stream : not null access Ada.Streams.Root_Stream_Type'Class; Item : My_Integer'Base) with Dispatching => Write(Stream); for My_Integer'Write use My_Write; For examples of use of the Use_Formal aspect, see the Element functions of Hashed_Sets in A.18.8. !discussion (See !summary.) !corrigendum 3.3.1(31/2) @drepl @xcode 0 .. 10_000 := 0; Sorted : Boolean := False; Color_Table : @b(1 .. Max) @b Color; Option : Bit_Vector(1 .. 10) := (@b =@> True); Hello : @b String := "Hi, world."; @unicode<952>, @unicode<966> : Float @b -@pi .. +@pi;> @dby @xcode 0 .. 10_000 := 0; Sorted : Boolean := False; Color_Table : @b(1 .. Max) @b Color; Option : Bit_Vector(1 .. 10) := (@b =@> True); -- @ft<@i> Hello : @b String := "Hi, world."; @unicode<952>, @unicode<966> : Float @b -@pi .. +@pi;> !corrigendum 3.6.1(13) @drepl @xcode @dby @xcode>> !corrigendum 3.8(27) @drepl @xcode<@b Date @b @b Day : Integer @b 1 .. 31; Month : Month_Name; Year : Integer @b 0 .. 4000; @b;> @dby @xcode<@b Date @b @b Day : Integer @b 1 .. 31; Month : Month_Name; -- @ft<@i> Year : Integer @b 0 .. 4000; @b;> !comment no corrigendum section for simple whitespace changes as in 3.8.1(25); !comment the editor is empowered to just make those. !corrigendum 4.3.5(0) @dinsc See the conflict file for the changes. !corrigendum 4.5.8(12/3) @drepl The assertion that a positive number is composite (as opposed to prime) can be written: @dby The assertion that a positive number N is composite (as opposed to prime) can be written: !corrigendum 9.4(31) @drepl @xcode<@b Shared_Array @b -- @ft<@i> @b Component (N : @b Index) return Item; @b Set_Component(N : @b Index; E : @b Item); @b Table : Item_Array(Index) := (others =@> Null_Item); @b Shared_Array;> @dby @xcode<@b Shared_Array @b -- @ft<@i> @b Component (N : @b Index) @b Item; @b Set_Component(N : @b Index; E : @b Item); @b Table : Item_Array(Index) := (@b =@> Null_Item); @b Shared_Array;> !corrigendum H.7.1(0) @dinsc See the conflict file for the changes. !ASIS No ASIS effect. !ACATS test No ACATS tests should be needed, none of these changes change any semantics. !appendix From the WG 9 review, Issue #25 3.3.1 (31/2) Add a "-- see 3.6" for Bit_Vector. **************************************************************** From the WG 9 review, Issue #31 3.6.1 (13) Add a "-- see 3.6" for Bit_Vector. **************************************************************** From the WG 9 review, Issue #33 3.8 (27) Add a "-- see 3.5.1" for Month_Name. **************************************************************** From the WG 9 review, Issue #61 9.4 (31) return and others should be bold. **************************************************************** From the WG 9 review, Issue #166 This example assumes that Map_Type has iterator aspects, which are not shown in its earlier declaration. Perhaps a comment should be added to this effect to avoid confusion. [Reply from editor:] Agreed. I'm tempted to delete 4.3.5(92/5) and 4.3.5(93/5), even though they are useful examples, because they violate our design principles for examples (in that they be compilable without "magic"). Defining the four needed aspects to support "of" iteration would really hide the purpose of these examples. The only alternative I can think of would be to somehow depend on the A.18.33 example for these iterators - but I'm not sure how to do that. [Reply from Tucker Taft:] At this point I would suggest we do one of the following: delete the two bullets; or add a comment saying "-- This presumes the Map type has the necessary aspects to permit iteration -- see A.18.5 for an example of these aspects"; or do nothing -- defer to next revision cycle. I think I favor the last choice. [Reply from editor:] I prefer splitting the baby: deleting the two paragraphs now (in AI12-0430-1), but deferring this issue to revisit it in the future (perhaps we should create a proper container-like iterator example somewhere, maybe 5.5.2, and if we did that we could use it here). I think we should delete the paragraphs now because incorrect examples can cause major confusion, particularly in this case when we're illustrating the use of iterators -- they really need to be properly declared so it doesn't appear that the compiler is conjuring them out of thin air. **************************************************************** From the WG 9 review, Issue #53 - Pat Rogers please vertically align end case with case and end record with record. [Editor's Reply:] This was wrong in the Ada 95 RM (I looked at my printed presentation copy), and presumably I carefully copied the mistake when creating the Consolidated version in 1998 (I did that with all of the errors in the Ada 95 RM). In fact, this example was copied from the Ada 83 RM (in which it is spaced correctly), but every version of the Ada 9x RM that had an example (all the way back to version 2.0 of March 1993!) has the incorrect spacing. Amazing that no one complained for 28.2 years!! Because of the age, I mentioned this in the example AI (even though we don't normally track whitespace changes). **************************************************************** From the WG 9 review, Issue #58 - Pat Rogers 4.5.8 (12/3) The assertion that a positive number {N} is composite ... **************************************************************** From the WG 9 review, Issue #81 - Tucker Taft H.7.1 could use examples of Use_Formal and Dispatching I suggest: Examples An example of use of the Dispatching aspect: procedure My_Write( -- see 13.13.2 Stream : not null access Ada.Streams.Root_Stream_Type'Class; Item : My_Integer'Base) with Dispatching => Write(Stream); for My_Integer'Write use My_Write; For examples of use of the Use_Formal aspect, see the Element functions of Hashed_Sets in A.18.8. ****************************************************************