Emanuel Berg <[email protected]> writes:
> Just try - and you will fly ...
>
> ;;; -*- lexical-binding: t -*-
>
> (defun c ()
> (message b) )
>
> (defun a (b)
> (message b)
> (setq b "ah")
> (c) )
>
> ;; (a "oh")
> ;; ^ eval me
Error message is displayed on *Backtrace* buffer.
Debugger entered--Lisp error: (void-variable b)
(message b)
c()
a("oh")
(progn (a "oh"))
eval((progn (a "oh")) t)
elisp--eval-last-sexp(nil)
eval-last-sexp(nil)
funcall-interactively(eval-last-sexp nil)
call-interactively(eval-last-sexp nil nil)
command-execute(eval-last-sexp)
And "ah" is displayed on mini buffer in case without
";;; -*- lexical-binding: t -*-".
> Also, byte-compiling this will echo a warning saying b is
> a free variable, and this even under dynamic/special scope
> where the code actually works tho (i.e. this particular use of
> 'a' and 'c' where 'a' is used first).
My understanding is 50%. Do you mean that using setq without
";;; -*- lexical-binding: t -*-" has no problem?
--
Satoshi Yoshida