Chap 3

You might also like

Download as odt, pdf, or txt
Download as odt, pdf, or txt
You are on page 1of 1

A procedural abstraction is a mapping from a set of inputs to a set of outputs which can be described by a

specification

There are essentially two different kinds of procedures which we shall call subroutines and functions. A
subroutine is a procedure which accomplishes its task either by assigning its results to one or more of its
parameters or by changing its environment or both. A function is a procedure which is characterized by the fact
that it returns a value. This allows an invocation of it to be a component of an expression.

By parameter passing we mean the manner in which the evaluated actual is transferred (or bound) to the
procedure. There are three major methods for parameter passing

In call-by-value, the actual parameter is dereferenced giving an r-value which is copied to a new location. This
location is bound to the formal.This is the default for parameter evaluation and passing in Pascal

In call-by-reference if the actual parameter is a location such as a variable name, then its location is bound
directly to the formal parameter. This is the mechanism usually employed in FORTRAN and PL/ 1.

Call-by-value-result is a method designed to incorporate the good features of call-by-value and call-by-
reference. When the actual parameter is a location, it is dereferenced and copied into a new location as in call-
by-value

You might also like