0

What is the meaning of the :type type-specifier on a slot in a defclass expression? It doesn't seem to work the same way as in defstruct:

* (defclass counter ()
    ((value :initform 0
            :type (integer 0 *)
            :accessor value)))
#<STANDARD-CLASS COMMON-LISP-USER::COUNTER>
* (defparameter *c* (make-instance 'counter))
*C*
* (value *c*)
0
* (decf (value *c*))
-1
* (value *c*)
-1

Why does (decf (value *c*)) not produce an error?

davypough
  • 1,847
  • 11
  • 21

0 Answers0