As opposed to dynamic scope, where bindings to variables in one procedure are visible in (assuming no further rebinding) all the procedures it calls, all procedures they call, etc. Dynamic scope has among its many disadvantages the problem that it is impossible (in the sense of `halting-complete') to ensure at compile time that variables are used only where they are in scope. This is perhaps the primary reason that most real programming languages nowadays use lexical scope.

When you combine lexical scope with functions as first-class objects (or, in general, escaping functions), you get (hopefully) closures. Not only do closures resolve free variables from the environment in which they were created---they do so even when called from outside that environment.

Languages with lexical scope include: