Closed kilianmh closed 2 years ago
Should SBCL be mentioned in the commit message, or leave it how it is?
Seriously, you don't get style warnings for the two ones that are now set with setf fdefinition
?
Defing a function with setf fdefinition
and using in the same file (here ends-with-p
in suffix?
and starts-with-p
in prefix?
) appears to be problematic for SBCL when loading a library (here str
) the first time. I am not sure if this behavior is intended or a bug in SBCL.
One way to shut down the warning is to wrap the defun
AND setf fdefinition
in eval-when
. That makes the functions available at compile time but adds one code line.
Instead the proposed solution simply defines the "-p" functions with defun
and the "?" with setf fdefinition
. This is also more in accordance with the lisp-lang.org Style Guide.
; in: DEFUN SUFFIX? ; (STR:ENDS-WITH-P SUFFIX S) ; caught STYLE-WARNING: undefined function: STR:ENDS-WITH-P ; in: DEFUN PREFIX? ; (STR:STARTS-WITH-P PREFIX S) ; caught STYLE-WARNING: undefined function: STR:STARTS-WITH-P
ENDS-WITH-P
andSTARTS-WITH-P
withDEFUN
ENDS-WITH?
andSTARTS-WITH?
with(SETF (FDEFINITION ...))
-> Avoid 2 style-warnings when loading
STR