Package enhanced-find-class
Description
Simply (:shadowing-import-from #:enhanced-find-class #:
from your defpackage. Don't find-class
)(:use)
!
enhanced-find-class
provides a canonical way of converting class designators to classes.
For whatever reason, find-class does not accept a class as first argument, making conversion of class designators to classes unnecessary painful due to the manual workarounds needed.
This is in contrast to find-package, which accepts a package, and find-restart, which accepts a restart, plus countless user-defined functions also wisely obeying the convention.
This library provides a drop-in replacement for find-class that addresses this pain point once and for all.
Simply (:shadowing-import-from #:enhanced-find-class #:
from your defpackage. Don't find-class
)(:use)
!
class-designator &optional errorp environment => class-or-nil
nil
.The semantics are exactly the same as for cl:find-class, except that if class-designator is a class then it is immediately returned (instead of signaling an error), regardless of the other arguments.
To help ensure proper optimization, this function is declaimed inline, its ftype is declared, and an appropriate compiler macro is defined so that we expand directly to a cl:find-class with the same arguments if class-designator is a constant evaluating to a symbol.