From: "Björn Lundin" <b.f.lundin@gmail.com>
Subject: Re: Better way to fill Storage_IO?
Date: Wed, 19 May 2021 22:18:47 +0200 [thread overview]
Message-ID: <s83rr7$krq$1@dont-email.me> (raw)
In-Reply-To: <s83oo3$s2s$1@dont-email.me>
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
next prev parent reply other threads:[~2021-05-19 20:18 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-05-17 18:44 Better way to fill Storage_IO? Michael Hardeman
2021-05-17 19:14 ` Simon Wright
2021-05-17 19:23 ` Michael Hardeman
2021-05-18 20:39 ` Simon Wright
2021-05-19 6:24 ` Dmitry A. Kazakov
2021-05-19 7:17 ` J-P. Rosen
2021-05-19 8:26 ` Björn Lundin
2021-05-19 19:25 ` J-P. Rosen
2021-05-19 19:58 ` Dmitry A. Kazakov
2021-05-19 20:18 ` Björn Lundin [this message]
2021-05-20 5:38 ` Niklas Holsti
2021-05-20 6:50 ` J-P. Rosen
2021-05-20 22:24 ` Randy Brukardt
2021-05-19 15:39 ` Simon Wright
2021-05-17 20:20 ` Dmitry A. Kazakov
2021-05-17 20:48 ` Michael Hardeman
2021-05-18 14:00 ` Per Sandberg
2021-05-18 9:08 ` J-P. Rosen
2021-05-18 10:10 ` Jeffrey R. Carter
2021-05-18 16:50 ` Shark8
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox