Because common lisp doesn't have special functions.
Check the description of EVAL
:
Evaluates form in the current dynamic environment and the null lexical environment.
Since the lexical environment is empty, your baz
function (defined by labels
) isn't accessible. You'd think you could fix this by putting baz
in the dynamic environment (you might want something like (declare (special baz))
or (declare (special (function baz)))
or something like this) but alas: there's no way to do this.
You could simulate it yourself by creating:
(defvar baz* nil)
(defun baz (&rest args) (apply baz* args))
You then need to dynamically set baz*
instead of using labels
:
(setf x '(foo bar (baz)))
(let ((baz* (lambda () (print "baz here"))))
(eval (third x)))
The reason why is just some hard bits about optimisation leaking into the spec. Basically, every function-call would need some stubbing unless the compiler could prove that the function would never get defined dynamically swizzleable. That's hard to do efficiently, and it's not something most CL programmers ever did, so the spec-writers simply forbade it.
As you can see, and as with most things in CL, you can easily get it yourself if you need it. However. Given that most CL programmers never do this, you may want to re-examine why you're trying to do things this way.