From: Jere <jhb.chat@gmail.com>
Subject: Re: Image attribute (yet again)
Date: Mon, 27 Apr 2020 05:50:04 -0700 (PDT)
Date: 2020-04-27T05:50:04-07:00 [thread overview]
Message-ID: <46d53a24-906e-4afc-a5b5-6d3235dfc658@googlegroups.com> (raw)
In-Reply-To: <r86jep$93r$1@dont-email.me>
On Monday, April 27, 2020 at 8:33:31 AM UTC-4, J-P. Rosen wrote:
> Le 26/04/2020 à 19:33, Jere a écrit :
> > I'm not saying it can't be done. I'm saying by the time I go through
> > all the processing needed, I might as well wrote my own function. It
> > makes the existing operation mostly useless (unless I just want a
> > temporary debug print that I don't care how it looks). For example,
> > if I want to print to a 16x2 character LCD screen and I want to print
> > 0 padded 4 digit hex values with no "16#" prefix or "#" ending, then
> > I need to call Put with an 8 character string, search for the first
> > occurrence of '#' (it can be in multiple locations), then overwrite
> > a variable number of those characters with 0's (based on the location
> > of '#'), and then extract the 4 digits I actually need. All doable
> > (not saying it cannot be done), but at that point, I am better off
> > just doing my own custom operation instead instead of even using the
> > Put operation.
> Right. If you want you own format, write it. It will take you less time
> than writing this message. For the benefit of everybody, here it is:
>
>
Yep, I do something similar to what you posted. I was just
asking if the standard provided something more than what
Put provided as it wasn't quite adequate for the general case.
It sounds like from your answer that I didn't miss
it (I was hoping!). As I said earlier, for stuff like this
I have generally rolled my own in Ada.
>
> > It feels like the Put operation wasn't designed
> > with usability in mind. Just the presence of the "16#" and "#"
> > around the value makes using the operation more clunky than it
> > should be. If that had been left out or if the operation at least
> > allowed for padding the actual numeric value inside the result,
> > then it would have been much more usable.
>
> Text_IO was designed for file operations, not so much for interactive
> IO. And there is an important feature of Text_IO which is rarely
> mentioned: If you use only the appropriate operations from Text_IO (no
> 'Image), and your program writes into a file, you can take the sequence
> of code that writes the file, replace every Put_* operation by the
> symetric Get_* operation, and you will read the file without error.
>
> This feature requires that if you write a number in a certain base, then
> you need to recognize the base when reading. So it's not an error, but a
> design decision. Of course, like any design decision, you may agree with
> it or not.
Conceptionally that makes sense. I do wish they had followed other
languages in at least providing some of the basic formatting options
for stuff like this. Even if it was a different package (String_IO?).
next prev parent reply other threads:[~2020-04-27 12:50 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-04-20 15:24 Image attribute (yet again) Stephen Davies
2020-04-25 22:35 ` Stephen Davies
2020-04-26 6:05 ` J-P. Rosen
2020-04-26 14:16 ` Jere
2020-04-26 17:09 ` Jeffrey R. Carter
2020-04-26 17:33 ` Jere
2020-04-27 12:33 ` J-P. Rosen
2020-04-27 12:50 ` Jere [this message]
2020-04-27 13:42 ` J-P. Rosen
2020-04-27 14:05 ` Jere
2020-04-27 14:55 ` Jeffrey R. Carter
2020-04-28 6:04 ` J-P. Rosen
2020-04-27 14:10 ` Jere
2020-04-28 6:02 ` J-P. Rosen
2020-04-28 13:03 ` Jere
2020-04-26 18:40 ` Oliver Kellogg
2020-04-26 18:42 ` Oliver Kellogg
2020-04-26 18:43 ` Oliver Kellogg
2020-04-27 12:52 ` Jere
2020-05-20 1:52 ` Shark8
2020-04-26 18:57 ` Stephen Davies
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox