< previous page page_395 next page >

Page 395
tions in the ScopeRules program with the scopes of visibility indicated by boxes.
Anything inside a box can refer to anything in a larger surrounding box, but outside-in references aren't allowed. Thus, a statement in Block3 could access any identifier declared in Block2 or any global variable. A statement in Block3 could not access identifiers declared in Block1 because it would have to enter the Block1 box from outside.
Notice that the formal parameters for a function are inside the function's box, but the function name itself is outside. If the name of the function were inside the box, no function could call another function. This demonstrates merely that function names are globally accessible.
Imagine the boxes in Figure 81 as rooms whose walls are made of twoway mirrors, with the reflective side facing out and the see-through side facing in. If you stood in the room for Block3, you would be able to see out
0395-01.gif
Figure 8-1
Scope Diagram for ScopeRules Program

 
< previous page page_395 next page >