Alias statement


 
SYNTAX:
alias_stmt = ALIAS variable_id FOR general_ref { qualifier } ';'                   stmt { stmt }
              END_ALIAS ';' .
The alias statement provides a local renaming capability for qualified variables and parameters. Within the scope of an alias statement, variable_id is implicitly declared to be an appropriately typed variable which holds the value referenced by the qualified identifier following the for keyword.
NOTE - The visibility rules for variable_id are described in ISO 10303-11 Chapter 10.3.1.
Example:
(*
Assuming there is an entity data type point with attributes x,y,z, alias may be used in the function calculate_length to reduce the length of the returned expression.
*)
 
ENTITY line;
 start_point, end_point : point;
END_ENTITY;
 
FUNCTION calculate_length (the_line : line) : real;
 ALIAS s FOR the_line.start_point;
  ALIAS e FOR the_line.end_point;
   RETURN(SQRT((s.x - e.x)*2 + (s.y - e.y)2 + (s.z - e.z)*2));
  END_ALIAS;
 END_ALIAS;
END_FUNCTION;