Next: , Previous: , Up: Variable Scoping   [Contents][Index]


16.8.1 Scope

SXEmacs Lisp uses indefinite scope for local variable bindings. This means that any function anywhere in the program text might access a given binding of a variable. Consider the following function definitions:

(defun binder (x)   ; x is bound in binder.
   (foo 5))         ; foo is some other function.
(defun user ()      ; x is used in user.
  (list x))

In a lexically scoped language, the binding of x in binder would never be accessible in user, because user is not textually contained within the function binder. However, in dynamically scoped SXEmacs Lisp, user may or may not refer to the binding of x established in binder, depending on circumstances: