書式化入出力・妄想

むしろ単にAdaがめんどくさ過ぎるだけか。
Text_IOは割と何でもPut(X);で出せることは出せるのですが、Putひとつにつきひとつの値しか出せないため、他の言語がWriteLn(X, Y, Z);で済むところをPut(X); Put(Y); Put(Z); New_Line;と書かないといけないのは、致命的ですよねぇ。

with Ada.Text_IO; 
with Ada.Integer_Text_IO;
procedure a is
begin
   declare
      use Ada.Text_IO;
      procedure Put (Item : Integer; Width : Field := 1; Base : Number_Base := Ada.Integer_Text_IO.Default_Base)
         renames Ada.Integer_Text_IO.Put;
   begin
      Put("test: "); Put(1); Put(" + "); Put(2); Put(" = "); Put(3); New_Line;
   end;
   declare
      procedure New_Line (Spacing : Ada.Text_IO.Positive_Count := 1) renames Ada.Text_IO.New_Line;
      type FT is null record;
      procedure Put(X : FT) is null;
      function "&" (Left : String; Right : Integer) return FT is
      begin
         Ada.Text_IO.Put(Left);
         Ada.Integer_Text_IO.Put(Right, Width => 1);
         return (null record); 
      end "&";
      function "&" (Left : FT; Right : String) return FT is
      begin
         Ada.Text_IO.Put(Right);
         return (null record); 
      end "&";
      function "&" (Left : FT; Right : Integer) return FT is
      begin
         Ada.Integer_Text_IO.Put(Right, Width => 1);
         return (null record); 
      end "&";
   begin
      Put("test: " & 1 & " + " & 2 & " = " & 3); New_Line;
   end;
end a;

返値でオーバーロードを解決してくれるのを利用。うーん。どうなんだ。"&"をいちいち用意しないといけないわけで、genericにしても組み合わせごとに最低一行ずつはインスタンス化書かないといけないわけで、こういうことしようとするならやっぱ暗黙のインスタンス化要るよな……。
あと"&"は"+"と同じ優先度なんですがこれより弱いのも比較演算子ぐらいしかなくて、変な記述を作ろうにもAdaの演算子が少なすぎるのも問題……。