The ALIAS Statement

IMLPlus provides the ALIAS statement to allow you to create aliases for modules. An alias is an alternative name for a module. An alias is similar to a function pointer in the C programming language. You can create aliases for the following types of modules:

You cannot create aliases for IML's built-in functions and subroutines.

The syntax of the ALIAS statement is

alias <*>name( parameters ) expression;

where

Some examples of using the ALIAS statement are:

alias *Evaluate( x ) "MyFunction";

alias DoAction( int n ) "MySubroutine";

m = "MyFunction";
alias *Evaluate( x ) m;

declare String s = "MySubroutine";
alias DoAction( int n ) s;

After you create an alias for a module, you can use the alias anywhere you would normally use the module's real name. For example:

y = Evaluate( 3.14 );
run DoAction( 2 );

An alias that is defined outside all modules has global scope and is in effect for the remainder of the program. An alias that is defined inside a module has local scope and is in effect only inside the module.

You can redefine an alias so it refers to a different module as long as all the modules referred to by the alias have the same signature (i.e. parameter list and return type).