Ada Reference Manual (Ada 2022)
5.2.1 Target Name Symbols
@, known as the target name of an assignment statement, provides an abbreviation to avoid repetition of potentially long names in assignment statements.
Syntax
target_name ::= @
Name Resolution Rules
If a target_name occurs in an assignment_statement A, the variable_name V of A is a complete context. The target name is a constant view of V, having the nominal subtype of V.
Legality Rules
Dynamic Semantics
For the execution of an assignment_statement with one or more target_names appearing in its expression, the variable_name V of the assignment_statement is evaluated first to determine the object denoted by V, and then the expression of the assignment_statement is evaluated with the evaluation of each target_name yielding a constant view of the target whose properties are otherwise identical to those of the view provided by V. The remainder of the execution of the assignment_statement is as given in 5.2.
Examples
Examples of the use of target name symbols:
Board(1, 1) := @ + 1.0;
-- An abbreviation for Board(1, 1) := Board(1, 1) + 1.0;
-- (Board is declared in 3.6.1).
-- An abbreviation for Board(1, 1) := Board(1, 1) + 1.0;
-- (Board is declared in 3.6.1).
My_Complex_Array : array (1 .. Max) of Complex; -- See 3.3.2, 3.8.
...
-- Square the element in the Count (see 3.3.1) position:
My_Complex_Array (Count) := (Re => @.Re**2 - @.Im**2,
Im => 2.0 * @.Re * @.Im);
-- A target_name can be used multiple times and
-- as a prefix if desired.
...
-- Square the element in the Count (see 3.3.1) position:
My_Complex_Array (Count) := (Re => @.Re**2 - @.Im**2,
Im => 2.0 * @.Re * @.Im);
-- A target_name can be used multiple times and
-- as a prefix if desired.