Ich bekomme eine Warnung vom sbcl-Compiler, dass eine Variable definiert wurde, aber nicht verwendet wird. Und der Compiler hat Recht. Ich möchte die Warnung loswerden, weiß aber nicht, wie ich es machen soll. Hier ein Beispiel:SBCL Warnung, dass eine Variable definiert ist, aber nie verwendet
(defun worker-1 (context p)
;; check context (make use of context argument)
(if context
(print p)))
(defun worker-2 (context p)
;; don't care about context
;; will throw a warning about unused argument
(print p))
;;
;; calls a given worker with context and p
;; doesn't know which arguments will be used by the
;; implementation of the called worker
(defun do-cmd (workerFn context p)
(funcall workerFn context p))
(defun main()
(let ((context()))
(do-cmd #'worker-1 context "A")
(do-cmd #'worker-2 context "A")))
Die do-cmd-Funktion erwartet Arbeiter-Funktionen, die eine bestimmte Schnittstelle f (Kontext p) umzusetzen.
Der sbcl Compiler wirft die folgende Warnung:
in: DEFUN WORKER-2
; (DEFUN WORKER-2 (CONTEXT P) (PRINT P))
;
; caught STYLE-WARNING:
; The variable CONTEXT is defined but never used.
;
; compilation unit finished
; caught 1 STYLE-WARNING condition
Ja. Vielen Dank. Sie haben mir sehr geholfen. – Ollimaus