4 ms·
Dynamic Scope let's you run code portions with their own variable bindings - without the need to pass arguments into the function and without the need to rebind
by lispm 9y ago
Dynamic Scope let's you run code portions with their own variable bindings - without the need to pass arguments into the function and without the need to rebind the variables lexically in surrounding code. The scope is dynamic, that means that the bindings are only active while the code is actually active - different from lexical binding, where closures capture bindings even then the closure generating code is no longer active.
Dynamic binding is usually called 'fluids' in Scheme. There are constructs like fluid-let which create dynamic bindings.
In Common Lisp the normal LET creates dynamic bindings when the variable is declared to be special. Variables defined by DEFVAR or DEFVARAMETER are declared special by definition.