beautypg.com

AMT Datasouth PAL User Manual

Page 20

background image

14

PAL Language Reference

an object or an operation associated with the name. If PAL encounters the name while creating a
procedure, PAL does not execute the name at that time. PAL simply stores the name as part of the
procedure. PAL will execute the name later when the programmer instructs PAL to execute the
procedure.

If the programmer places a single forward slash in front of the name, PAL treats the name as
literal. For example, PAL will treat the character sequence "/MyName" as a literal name. This
means that PAL will simply create a name object in a manner similar to a string object.

If the programmer places two forward slashes in front of the name, PAL immediately evaluates the
name. For example, PAL will treat the character sequence "//MyName" as an immediately
evaluated name. When PAL evaluates, as opposed to executes, a name, PAL simply replaces the
name with the object associated with the name. PAL does not attempt to execute the object
associated with the name.

Except during a procedure definition, the difference between executable and immediately evalu-
ated only matters for names associated with procedures or PAL intrinsic operators. In all other
case, executable and immediately evaluated names produce the same results.

During a procedure definition, PAL simply records executable names as part of the procedure. It
does not attempt to execute the name at that time. However, PAL still substitutes immediately
evaluated names with their associated objects even during procedure definitions.

Using an immediately evaluated name during a procedure definition can produce entirely different
results from using an executable name. For example, the programmer has associated the name
FirstProc with a procedure object. The programmer then defines a second procedure,
SecondProc, which includes a reference to FirstProc.

If the programmer specifies FirstProc as an executable name (no "/" in front of the name), PAL
will simply record the executable name FirstProc within SecondProc's definition. Later, when
the programmer instruct PAL to execute SecondProc, PAL will also execute the procedure
associated with the name FirstProc when it encounters the executable name.

If the programmer changes the procedure associated with FirstProc between executions of
SecondProc, PAL will always execute the procedure associated with FirstProc at the time PAL
executes SecondProc. It will not matter which procedure was associated with FirstProc at the
time SecondProc was defined. In fact, PAL will not care whether the programmer has associated
any procedure with FirstProc before defining SecondProc. PAL only cares about the procedure
associated with FirstProc's at the time PAL encounters FirstProc when executing SecondProc.

If the programmer specifies FirstProc as an immediately evaluated name (//FirstProc) within the
definition of SecondProc, PAL will immediately substitute //FirstProc with the current object
associated with FirstProc. This means that PAL will place the procedure object associated with
FirstProc directly within the definition of SecondProc.

PAL will insert the procedure object and not the instructions contained within the procedure
object. This will have the same effect as having used the "{" and "}" operators to define the pro-
cedure directly within SecondProc. When PAL encounters the procedure object while executing
SecondProc, PAL will simply push the procedure object onto the operand stack. PAL will not
automatically try to execute the instructions contained within the procedure object.

Names can include almost any combination of characters, numbers, and special symbols. However,
names do not have special enclosing characters like the parenthesis required by strings. This means