TAL Programmer's Guide

Declaring Parameters in Procedures
Using Procedures
096254 Tandem Computers Incorporated 11–3
Declaring Parameters
in Procedures
You can include formal parameters in the procedure declaration. Callers can then pass
corresponding actual parameters for use in the called procedure.
Specifying a Formal
Parameter List
To include formal parameters in a procedure declaration, specify a comma-separated
list (enclosed in parentheses) of up to 32 formal parameters.
PROC proc_a (param1, param2); !Declare PROC_A; include
! formal parameter list
Declaring Formal
Parameters
After specifying the formal parameter list, declare each formal parameter by
specifying:
A parameter type (for example, STRING, INT, STRUCT, or PROC). A procedure
can have any number of parameter words.
The identifier of the parameter.
If the parameter is a reference parameter, precede the identifier with an indirection
symbol (. or .EXT). The absence of an indirection symbol denotes a value
parameter. Table 11-1 describes value and reference parameters.
Table 11-1. Value and Reference Parameters
Formal
Parameter Description
Indirection
Symbol Passed Value
Value The caller passes a value. The called
procedure cannot change the original value in
the caller's scope.
No Simple variable,
constant expression,
or procedure
Reference The caller passes the address of a value. The
called procedure can change the original value
in the caller's scope.
Yes Address of simple
variable, array, or
structure
For example, you can declare simple variables as value and reference formal
parameters. The compiler treats the value parameter as if it were a simple variable.
The compiler treats the reference parameter as if it were a simple pointer:
PROC proc_x (val_param, ref_param); !Include parameter list
INT val_param; !Declare value parameter
INT .ref_param; !Declare reference parameter
BEGIN
ref_param := val_param + ref_param;
!Manipulate parameters
END;
For more information on parameter specifications, see Table 11-3 later in this section.