LOCALITY IN CODE
In computing, locality of reference describes the tendency of a processor to access the same set of memory locations repetitively over a short period. Temporal locality. Spatial locality. The cache hit is the system's way of saying: I know your jurisdiction.
THE BOUNDARY PROBLEM
Every local scope creates a boundary. Variables declared inside a function cannot be seen from outside. This is jurisdiction in its purest form: authority confined to a defined territory, invisible and impermeable to those beyond its borders.
The local cop patrols its block. It knows every variable on its beat. It does not answer to the global scope unless explicitly called. This is not limitation -- it is sovereignty.
SCOPE CHAINS AND CLOSURES
A closure is a function that remembers its lexical scope even when executed outside that scope. It carries its jurisdiction with it -- a detective who never forgets which precinct issued the warrant, no matter how far the investigation takes them.
The scope chain is the chain of command. Each link is a nested function, each node a boundary that can be crossed upward but never downward. Information flows to the top. Orders flow from the top. The local cop reports to the precinct. The precinct reports to the division.
LOCAL FIRST
The principle of least authority: give each component only the permissions it needs, confined to the smallest possible scope. Every variable should be as local as it can be. Every function should know only what it must. The best system is the one where no single part can see the whole.