From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.5-pre1 (2020-06-20) on ip-172-31-74-118.ec2.internal X-Spam-Level: X-Spam-Status: No, score=-0.9 required=3.0 tests=BAYES_00,FORGED_GMAIL_RCVD, FREEMAIL_FROM autolearn=no autolearn_force=no version=3.4.5-pre1 Path: eternal-september.org!reader02.eternal-september.org!.POSTED!not-for-mail From: =?UTF-8?Q?Bj=c3=b6rn_Lundin?= Newsgroups: comp.lang.ada Subject: Re: Better way to fill Storage_IO? Date: Wed, 19 May 2021 22:18:47 +0200 Organization: A noiseless patient Spider Message-ID: References: <3cfe02b8-18d3-4673-b808-48ad29092517n@googlegroups.com> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit Injection-Date: Wed, 19 May 2021 20:18:47 -0000 (UTC) Injection-Info: reader02.eternal-september.org; posting-host="3294e74acc61672f724a4128636404d8"; logging-data="21370"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18gpE9TJzG2XP3UKjEne3DI" User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.13; rv:78.0) Gecko/20100101 Thunderbird/78.10.1 Cancel-Lock: sha1:hH+87+XWpJP73oSIfAUFeIokMqI= In-Reply-To: Content-Language: en-US Xref: reader02.eternal-september.org comp.lang.ada:62015 List-Id: Den 2021-05-19 kl. 21:25, skrev J-P. Rosen: > Le 19/05/2021 à 10:26, Björn Lundin a écrit : >> Given the above I do prefer >> >> >> Text_IO.Put_Line ("Next is " & Next_Location'Image); >> >> over >> >> Text_IO.Put_Line ("Next is " & >> Coded_Values.WCS_Next_Location_Type_Type'Image(Next_Location)); > > Interesting example. When I define a type that I want to be able to > print, I define also (in the same place) an instantiation of > Integer_IO/Enumeration_IO, and I would write: >    Put ("Next is "); Put (Next_Location); New_Line; > > 'Image was not intended for regular IO. > If a function/procedure is public, users will use them. And very likely in ways 'not intended', So there should be a clear statement in the RM making it clear that using 'Image is not for regular IO. We use tons of it for writing to log files This is why I want 'image for record types. It would save me from writing To_String functions dumping record values into the log. I think it made it into 202x but I am not sure. And reasoning 'when I define a type I want to print...' does not really appeal to me. I'd like the language to provide a way to create a string version of my variables - basically any of them - for log file use. When I define a type I am not always thinking if this may or may not will be logged in the future, by someone else. This leads to all types must define a Image/To_String function. Why? Whats the point? What is the gain? For records with nested lists I can see challenges, but for scalar values? Floats? Fixed? Why not have an easy-to-use AND readable solution? -- Björn