-- Date: 11/06/2022
with Ada.Text_IO; Use Ada.Text_Io;
procedure Masques is
type XX is record
X1 : character range 'A'..'D';
X2 : character range 'E'..'H';
X3 : character range 'I'..'L';
end record;
begin
Get_Line (XX);
end Masques;
I'm trying to write some sort of input masks to control the inputs as we do in IT. Of course the above example doesn't compile because Get_Line can't accept a record. Of course we can write an operation to put the characters together to create a string, thru a get or get_immediate.
-But the idea would be to use the language typing to control the input & to trap the errors by an exception by example.
-Some years ago, to the best of my recollection, i remember someone did this, but I'm unable to write it.. Thanks for the help.
'Valid
attribute, examined here. See also Gem #83: Type-Based Security 2: Validating the Input.