License: Public Domain , Load it with Quicklisp: (ql:quickload "enhanced-find-class")
Library type: Convenience function , Project complexity: Embarrassingly trivial

enhanced-find-class provides a canonical way of converting class designators to classes.

Overview

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.

Dictionary

Dictionary » enhanced-find-class

Package enhanced-find-class

Description

Simply (:shadowing-import-from #:enhanced-find-class #:find-class) from your defpackage. Don't (:use)!

Dictionary » find-class

Function find-class

class-designator &optional errorp environment => class-or-nil

Arguments and Values

Description

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.