我盯着斯蒂尔的 Common Lisp the Language ,直到我脸红了,仍然有这个问题。如果我编译:
(defun x ()
(labels ((y ()))
5))
(princ (x))
(terpri)
这种情况发生了:
home:~/clisp/experiments$ clisp -c -q x.lisp
;; Compiling file /u/home/clisp/experiments/x.lisp ...
WARNING in lines 1..3 :
function X-Y is not used.
Misspelled or missing IGNORE declaration?
;; Wrote file /u/home/clisp/experiments/x.fas
0 errors, 1 warning
home:~/clisp/experiments$
足够公平。那么我如何要求编译器忽略函数y?我试过这个:
(defun x ()
(labels (#+ignore(y ()))
5))
(princ (x))
(terpri)
它起作用了:
home:~/clisp/experiments$ clisp -c -q y.lisp
;; Compiling file /u/home/clisp/experiments/y.lisp ...
;; Wrote file /u/home/clisp/experiments/y.fas
0 errors, 0 warnings
home:~/clisp/experiments$
但不知怎的,我不认为这是警告暗示我的意思。
我该怎么办?