I have a very weird requirement that lexically binding a special variable of another package.
In file A.lisp
(defpackage A
(:use #:CL)
(:export #:a-test))
(in-package A)
(declaim (special *a-sp-v*))
(defun a-test (&key (v *a-sp-v*))
(print v))
in file B.lisp
(defpackage B
(:use #:CL #:A))
(in-package B)
(defun b-test ()
(let ((*a-sp-v* 1)) ; cannot let a-test know
(a-test)))
I keep receiving the error The variable A::*A-SP-V* is unbound.
in my REPL.
Are there some methods I can bind *a-sp-v*
in the package B
? Let a-test
function running with special *a-sp-v*
no matter what package it is in?