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=-1.9 required=3.0 tests=BAYES_00 autolearn=ham autolearn_force=no version=3.4.5-pre1 Path: eternal-september.org!reader02.eternal-september.org!aioe.org!5WHqCw2XxjHb2npjM9GYbw.user.gioia.aioe.org.POSTED!not-for-mail From: "Dmitry A. Kazakov" Newsgroups: comp.lang.ada Subject: Re: Better way to fill Storage_IO? Date: Wed, 19 May 2021 21:58:25 +0200 Organization: Aioe.org NNTP Server Message-ID: References: <3cfe02b8-18d3-4673-b808-48ad29092517n@googlegroups.com> NNTP-Posting-Host: 5WHqCw2XxjHb2npjM9GYbw.user.gioia.aioe.org Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit X-Complaints-To: abuse@aioe.org User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101 Thunderbird/78.10.1 Content-Language: en-US X-Notice: Filtered by postfilter v. 0.9.2 Xref: reader02.eternal-september.org comp.lang.ada:62014 List-Id: On 2021-05-19 21:25, J-P. Rosen wrote: > 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. Maybe it was so in 1983. These days immediate I/O is impractical. Most of use cases is about formatting strings and very rarely writing the result into some file, usually stream. So 'Image is far more frequently used than Integer_IO, Enumeration_IO etc. I did not use any of that for decades. A programmer would not even care about them, because he will not suddenly change the programming technique universally used with GUI widgets, streams, database interfaces, for some obscure generic packages when Text_IO gets involved. So let's modify the example to: Dialog.Message.Set_Text ("Next is " & Coded_Values.WCS_Next_Location_Type_Type'Image(Next_Location)); -- Regards, Dmitry A. Kazakov http://www.dmitry-kazakov.de