てきとう

てきとう

1からやり直し:hello, world編

基本

with Ada.Text_Io;
procedure Hello is
begin
   Ada.Text_Io.Put_Line("hello, world");
end Hello;

応用:use

with Ada.Text_Io;
use Ada.Text_Io;
procedure Hello is
begin
   Put_Line("hello, world");
end Hello;

応用:renames

with Ada.Text_Io;
procedure Hello is
   package TIO renames Ada.Text_Io;
begin
   TIO.Put_Line("hello, world");
end Hello;

宣言時にrenamesを使うと別名として宣言できます。
パッケージに短く適当な別名をつけることで、書く際の負担を減らしつつ可読性を上げることができます。