License: Public Domain , Load it with Quicklisp: (ql:quickload "canonicalized-initargs")
Library type: Convenience feature , Project complexity: Simple/Medium

canonicalized-initargs provides a :canonicalize slot option
accepting an initarg canonicalization function.


Traditionally, there has been no standard way to canonicalize slot values. For instance, you might declare a slot as having type string, but prefer to let the user specify any string designator. In this situation, there are various suboptimal approaches you could take:

The complete lack of built-in support for slot value canonicalization (or even of a standard idiom for it) might be seen as one of the biggest unacknowledged blind spots in the Common Lisp language. (Although most programming languages probably share that limitation.)

canonicalized-initargs implements the platonically ideal solution using the MOP. You can just pass :canonicalize #'string as a slot option and the corresponding initarg will be canonicalized! There is also a :canonicalize class option (similar to :default-initargs) to canonicalize initargs not necessarily associated with slots.

This is a very intuitive and broadly useful killer app for the MOP!

This library is currently undocumented, sorry. See note on Libraries page.


Dictionary » canon-initargs

Package canon-initargs


This package is also nicknamed canonicalized-initargs.

All symbols from this package should normally be explicitly qualified, such as canon-initargs:standard-class.
Don't (:use)!