I'm trying to create a class that can store a vector of symbols in a slot in SBCL. I cannot figure out how to set it up.
My best guess thus far has been
(defclass Individual ()
((discrete-decisions :type (vector symbol))))
This returns the following error:
keyword argument not a symbol:
(DISCRETE-DECISIONS :TYPE (VECTOR SYMBOL)).
[Condition of type SB-INT:SIMPLE-PROGRAM-ERROR]
Some experimenting has shown that changing the type to just symbol
returns the same error. I thought that symbol
was a valid type in Common Lisp... am I mistaken?
How can I get this to work?
[EDIT]
The above problem I had was running SBCL 1.0.58 in the 09-22-2012 Slime build under Emacs 24.2. When I run SBCL 1.0.58 from the command line, there is no problem. This doesn't seem like an SBCL issue...
You might consider defining an :after method on slot accessor/writer. Also, the ultimate degree of control can be exercised by defining your own metaclass and customization of slot-value-using-class
I know I'm probably too late, but you should wrap around your classe declaration with a optimization for safety. For example:
(locally (declare (optimize safety))
(defclass test-class ()
((some-slot :type real :initarg :some-slot :accessor :test-some-slot))))
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With