Though I recognize that there is no way to do printf style in a
type-safe fashion, short of going to a fully-dynamic language.
C++ does that polymorphism stuff in iostream so you'd write
std::cout << "my name: " << command_line << ...
printf for some people is one of the motivations for dependent types.
tio.put("my name: ");
tio.put(cli.Command_name);
tio.Put_Line("");
tio.Put("nr args: ");
int_io.Put(cli.Argument_Count, width => 1);
tio.Put_Line("");
tio.put("[");
int_io.put(i, width => 1);
tio.put("]: ");
tio.put(cli.argument(i));
tio.put_line("");
with Ada.Command_Line;[...]
with Ada.Text_IO;
On Wed, 03 Jul 2024 18:16:01 -0700, Paul Rubin wrote:
I wonder how you would express such a thing in an Ada-friendly fashion?
On Wed, 03 Jul 2024 18:16:01 -0700, Paul Rubin wrote:
printf for some people is one of the motivations for dependent types.
I wonder how you would express such a thing in an Ada-friendly fashion?
... Though I recognize that there is no way to do printf style in a
type-safe fashion, short of going to a fully-dynamic language.
... Though I recognize that there is no way to do printf style in aNo so. Haskell has Text.Printf.
type-safe fashion, short of going to a fully-dynamic language.
On 2024-07-04 02:08, Lawrence D'Oliveiro wrote:
Remember that you can concatenate strings:
tio.put("my name: ");
tio.put(cli.Command_name);
tio.Put_Line("");
Tio.Put_Line (Item => "my name: " & Cli.Command_Name);
For more complex uses, you can use something like
PragmARC.Images[.Image] (https://github.com/jrcarter/PragmARC).
On Thu, 4 Jul 2024 13:27:05 +0200, Jeffrey R.Carter wrote:
On 2024-07-04 02:08, Lawrence D'Oliveiro wrote:I’m sure I can, but I’m not sure what the point is. Let Ada collect the pieces in its own buffers. That saves copying steps.
Remember that you can concatenate strings:
tio.put("my name: ");Tio.Put_Line (Item => "my name: " & Cli.Command_Name);
tio.put(cli.Command_name);
tio.Put_Line("");
Sysop: | DaiTengu |
---|---|
Location: | Appleton, WI |
Users: | 991 |
Nodes: | 10 (0 / 10) |
Uptime: | 81:36:12 |
Calls: | 12,949 |
Calls today: | 3 |
Files: | 186,574 |
Messages: | 3,264,673 |