!standard G.01.03 (10) 03-12-03 AI95-00328/03 !class amendment 03-06-05 !status Amendment 200Y 03-07-15 !status WG9 Approved 03-12-12 !status ARG Approved 9-0-0 03-06-22 !status work item 03-06-05 !status received 03-06-05 !priority Low !difficulty Easy !subject Preinstantiations of Complex_IO !summary Pre-instantiations of Ada.Text_IO.Complex_IO are added. !problem Ada.Text_IO.Complex_IO does not have any pre-instantiation, while all other language defined generics do. This is inconsistent and should be fixed. !proposal (See wording.) !wording Add before G.1.3(10): The library package Complex_Text_IO defines the same subprograms as Text_IO.Complex_IO, except that the predefined type Float is systematically substituted for Real, and the type Numerics.Complex_Types.Complex is systematically substituted for Complex throughout. Non-generic equivalents of Text_IO.Complex_IO corresponding to each of the other predefined floating point types are defined similarly, with the names Short_Complex_Text_IO, Long_Complex_Text_IO, etc. !example None needed. !corrigendum G.1.3(10) @dinsb The semantics of the Get and Put procedures are as follows: @dinst The library package Complex_Text_IO defines the same subprograms as Text_IO.Complex_IO, except that the predefined type Float is systematically substituted for Real, and the type Numerics.Complex_Types.Complex is systematically substituted for Complex throughout. Non-generic equivalents of Text_IO.Complex_IO corresponding to each of the other predefined floating point types are defined similarly, with the names Short_Complex_Text_IO, Long_Complex_Text_IO, etc. !ACATS test A C-Test should be created to insure that this instantiation exists and works as expected. !appendix From: John Barnes Sent: Thursday, June 5, 2003 1:16 AM At the last meeting I mentioned that one of the generic packages did not have preinstantiated equivalents. I promised to tell you which one. It is Text_IO.Complex_IO. The name is unhelpful. It ought to be Text_IO.Generic_Complex_IO so that Text_IO.Complex_IO would be the preinstantiated version with type Float (or strictly with Complex_Types which itself is based on type Float). Pascal suggests the following solution: "The name is consistent with the packages nested in Text_IO, e.g., Ada.Text_IO.Integer_IO. Maybe those names were poorly chosen, and we should blame Jean, but it's water under the bridge at this point. I think we should do the same thing as was done for Integer_IO. In this case the non-generic equivalents are named Ada.Integer_Text_IO, Ada.Long_Integer_Text_IO, etc. So I am proposing to add a Ada.Complex_Text_IO, Ada.Long_Complex_Text_IO, etc." Any comments? **************************************************************** From: Robert Dewar Sent: Thursday, June 5, 2003 6:26 AM I never heard of anyone using this package. I think this is solving a non-problem. The preinstantiations are for beginning users to simplify things a bit, I see no possible reason for thinking that beginners would be using Complex_IO. Also I would find the name Text_IO.Generic_Complex_IO to be oddly inconsistent with Text_IO.Integer_IO. The preinstantiations are really rather junky anyway, especially the integer ones, which are clearly incompatible with good Ada usage (avoid Integer in the first place). **************************************************************** From: Tucker Taft Sent: Thursday, June 5, 2003 9:56 AM On the other hand, since we have preinstantiations of complex, and preinstantiations of float-io, it seems to make sense to have preinstantiations of complex-io. Although convenience for teaching was perhaps the initial impetus for some of the preinstantiations, orthogonality and consistency of language/library design takes over at some point, and we should "complete" the set of preinstantiations. While we are at it, I might argue for Boolean_Text_IO and Duration_Text_IO, because these are perhaps even more appropriate than Integer_Text_IO, since as Robert points out, using Integer is generally "bad form," while using Boolean and Duration seems eminently reasonable. **************************************************************** From: Robert Dewar Sent: Thursday, June 5, 2003 4:31 PM Again, I see these preinstantiations as being reasonable only for use by students and beginners, and neither of these is particularly convincing. Personally I always tell students to use 'Image anyway. It's easier in any case to write Put_Line (Integer'Image (Y)); (or in GNAT Put_Line (Y'Img)) than Put (Y); New_Line; **************************************************************** From: Robert I. Eachus Sent: Thursday, June 5, 2003 12:41 PM Tucker Taft wrote: > On the other hand, since we have preinstantiations > of complex, and preinstantiations of float-io, > it seems to make sense to have preinstantiations > of complex-io. Although convenience for teaching > was perhaps the initial impetus for some of the > preinstantiations, orthogonality and consistency of > language/library design takes over at some point, and we > should "complete" the set of preinstantiations. I argee, adding a one line preinstantiation of Complex_IO is one line of code. Hardly a burden on implementors. > While we are at it, I might argue for Boolean_Text_IO > and Duration_Text_IO, because these are perhaps even > more appropriate than Integer_Text_IO, since as Robert > points out, using Integer is generally "bad form," > while using Boolean and Duration seems eminently reasonable. Duration_IO would be a definite plus. Boolean_IO would IMHO be a waste of effort, similar to instantiating Enumeration_IO for Character. Maybe not quite as bad, but still something you don't want beginners to be misled by. ****************************************************************