Last active
May 25, 2020 07:27
-
-
Save earl-ducaine/9610a0714bf71cf98c86510a9e71d1e9 to your computer and use it in GitHub Desktop.
Using (declare (special ...))
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(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