vindarel / cl-str

Modern, simple and consistent Common Lisp string manipulation library.
https://vindarel.github.io/cl-str/
MIT License
305 stars 37 forks source link

Fix style-warnings undefined function #79

Closed kilianmh closed 2 years ago

kilianmh commented 2 years ago

; 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

-> Avoid 2 style-warnings when loading STR

kilianmh commented 2 years ago

Should SBCL be mentioned in the commit message, or leave it how it is?

vindarel commented 2 years ago

Seriously, you don't get style warnings for the two ones that are now set with setf fdefinition?

kilianmh commented 2 years ago

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.