Skip to main content

Alias

An alias is another name for a type. A variable declared as an alias type is no different from a variable declared of the underlying type. It is possible to assign the alias variable to the variable of the underlying type. An alias could be used as a form of shorthand notation for a type but is otherwise not used frequently as it can mask or hide the variable's type.

Syntax

Alias declaration
TYPE <AliasName> : <AliasedType>
END_TYPE

Sample

TYPE ST_A :
STRUCT
a : INT := 3;
END_STRUCT
END_TYPE

// Renames the ST_A type
TYPE T_MyAlias : ST_A;
END_TYPE

VAR
alias : T_MyAlias;
inst : ST_A;
END_VAR

alias := inst;
alias.a := alias.a + 1; // 4