Skip to content

Instantly share code, notes, and snippets.

@earl-ducaine
Last active May 25, 2020 07:27
Show Gist options
  • Save earl-ducaine/9610a0714bf71cf98c86510a9e71d1e9 to your computer and use it in GitHub Desktop.
Save earl-ducaine/9610a0714bf71cf98c86510a9e71d1e9 to your computer and use it in GitHub Desktop.
Using (declare (special ...))
(defun get-my-value ()
(list val))
(defun my-value ()
(let ((val nil))
(locally
(declare (special val))
(setf val t)
(get-my-value))))
(makunbound 'val)
(unintern (find-symbol "VAL"))
;; (find-symbol "VAL")
;; => NIL
;;
;; (my-value)
;; (T)
;;
;; (find-symbol "VAL")
;; => NIL
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment