Andreas Röhler <andreas.roehler@easy-emacs.de> writes:
http://www.emacswiki.org/emacs/DynamicBindingVsLexicalBinding
it's said WRT lexical binding
"Because it's (1) much easier for the user [that is, programmer], because
it eliminates the problem of which variables lambda-expressions use
(when they attempt to use variables from their surrounding context)"
Unfortunately couldn't find a use-case where it is easier - while consenting it
might be easier for the compiler to swallow.
Could someone give an example, where lexical binding makes coding easier?
Consider this rather obvious higher-order function:
(defun addinator (a)
(lambda (b)
(+ a b)))
;; This doesn't work with dynamic binding, at all
(funcall (addinator 3) 4)
;; This returns wrong result with dynamic binding
(let ((a 42))
(funcall (addinator 3) 4))