Professional Documents
Culture Documents
Control II Group 9
Control II Group 9
PROCEDURES AND
ENVIRONMENTS
GROUP 9
• PROCEDURE DEFINITION AND ACTIVATION
• PROCEDURE SEMANTICS
• PARAMETER-PASSING MECHANISMS
• PROCEDURE ENVIRONMENTS, ACTIVATIONS, AND
ALLOCATION
• DYNAMIC MEMORY MANAGEMENT
• EXCEPTION HANDLING AND ENVIRONMENTS
• CASE STUDY: PROCESSING PARAMETER MODES IN
TINYADA
PROCEDURE DEFINITION AND ACTIVATION
• In pass by value, by far the most common mechanism for parameter passing,
the arguments are expressions that are evaluated at the time of the call, with
the argument’s values becoming the values of the parameters during the
execution of the procedure.
• In the simplest form of pass by value, value parameters behave as constant
values during the execution of the procedure.
PASS BY REFERENCE
• Pass by name is the term used for this mechanism when it was introduced in
Algo160. at the time it was intended as a kind of advanced in lining process for
procedures, so that the semantics of procedures could be described simply by a
form of textual replacement, rather than an appeal to environments and
closures. It turned out to be essentially equivalent to the normal order delayed
evaluation. It also turned out to be difficult to implement, and to have complex
interactions with other language constructs, particularly arrays and assignment.
• The idea of pass by name is that the argument is not evaluated until its actual
use as a parameter in the called procedure. Thus, the name of the argument,
or its textual representation at the point call, replaces the name of the
parameter to which it corresponds
DYNAMIC MEMORY MANAGEMENT