DynamicScoping

Last edit

Summary: Rückgängig gemacht auf den Stand vom 2013-08-24 11:21 UTC

Changed:

< (let ((case-fold-WikiModes t))

to

> (let ((case-fold-search t))


DynamicScoping is the opposite of to LexicalScoping?.

DynamicScoping is what you get in C with global variables: if you change them, it will affect any further reference to this variable: the value of a variable is the result of ist last affectation in execution time. By contrast, with LexicalScoping? the value of a variable is the result of its last affectation in code, or in compilation time.

For instance:

    (setq var 'foo)
    (defun func () var)
    (let ((var 'bar))
       (func))

When evaluating the last sexp, you would get bar with DynamicScoping and foo with LexicalScoping?.

DynamicScoping enables you to write code such as:

    (let ((case-fold-search t))
       (function))

See DynamicBindingVsLexicalBinding


CategoryGlossary