Hi,
I have a class in Common Lisp:
(defclass my-cool-class()
((variable1
:initarg :variable1
:accessor variable1
:initform (error "Must supply value to variable1"))
(variable2
:initarg :variable2
:accessor variable2
:initform (error "Must supply value to variable2"))
I wanted to create a macro that would simplify this redundancy of typing
(defmacro make-slot (slot-name)
`(slot-name
:initarg :,slot-name
:accessor :,slot-name
:initform (error "Must supply value")))
Eventually I'd like to have (defclass my-cool-class () (make-slots '(foo bar baz)) and get foo, bar, and baz out as slots automagically.
But, when I went to do a macroexpand-1
of make-slot, boy howdy did I get reader errors.
The first one was "illegal terminating character after a colon..." and then it kept going.
SBCL 1.0.37.
edit: the examples are syntactically correct on the system, I did some redaction before I copied.