142
Since
the
value
of
a local name disappears
as
soon
as
execution
of
the
function
finishes, the only
time
you
can use
or
display
the
value
of
a local name
is
while
the
function
to
which it belongs
is
still executing.
is
suspended,
or
is
pendent.
Note: If a name
is
local
to
a
function
that
calls
another
function,
the
value
of
that
local name can also be used by
the
called
function.
A name local
to
a
function
that
has
not
completed
execution
or
that
is
suspended
(see Chapter 7) will be inaccessible if
the
name
is
also local
to
a
more
recently
called function. Putting
it
another
way,
the
value
of
a name
that
you
can use
or
display
is
always
the
most
recent
local value
of
the
name. Of course, as execu-
tion
of
the
more recently called functions
is
completed,
the
next
earlier value
of
each local variable will again be accessible. A name can
therefore
be said
to
have
one
active referent
or
value,
and
possibly several latent referents
or
values. For
example:
\l
DANiXX
I:
:to
]
xx·~"
100
[2J
'THE
FUNCTION
DAN
GIVES
XX
THE
VALUE'
r:::3]
XX
[~J
'AND
CALLS
THE
FUNCTION
DAVE'
[~:;]
DAVE
[6J
'WHEN
DAVE
IS
THROUGH
EXECUTING
AND
EXECUTION
RETURNS'
[7J
'TO
DANI
XX
ONCE
AGAIN
HAS
THE
VALUE'
[aJ
XXV
V
DAVEiXX
[:r.]
XX~-20
0
[2]
'THE
FUNCTION
DAVE
GIVES
XX
THE
VALUE'
[3J
XX
[~]
'AND
CALLS
THE
FUNCTION
JERRY'
[5J
JERRY
[6J
'WHEN
JERRY
IS
THROUGH
EXECUTING
AND
EXECUTION
RETURNS'
[7J
'TO
DAVE,
XX
ONCE
AGAIN
HAS
THE
VALUE'
[aJ
XX'\]
--------------------------I-J
'V
,JEI~I~Y
i
XX
[1.]
XX~-:~OO
[2J
'THE
FUNCTION
JERRY
GIVES
XX
THE
VALUE'
[:3]
XX
[4·]
'AND
RETUI~NS
TO
DAVE"\I
-------------------'