"...it is entirely legal to have a lexically scoped (unspecial) global variable."
This issue has been bothering me: The use of setf for global variables. I have seen this even in Peter Norvig's PAIP. I know you should not use setf like defvar, but it seems that is the case with these books. I have looked at CLtL 2nd edition and it makes no mention of using setf this way, so I am assuming using setf this way is something even older. Here is a typical example from the Touretzky's book that I want to explore further:
Code: Select all
(setf fish '(salmon tuna))
(defun ref-fish () fish)
(defun test-lexical (fish)
(list fish (ref-fish)))
(test-lexical '(guppy minnow))
((GUPPY MINNOW) (SALMON TUNA))