#26: slto-value type check --------------------+------------------------------------------------------- Reporter: rtoy | Owner: somebody Type: defect | Status: new Priority: minor | Milestone: Component: Core | Version: 2008-11 Keywords: pcl | --------------------+------------------------------------------------------- From cmucl-help, 2008-11-26 {{{ (defclass foo () ((a :type fixnum)))
(defvar *object* (make-instance 'foo)) }}}
This works, even though the assigned value is not a fixnum: {{{ (setf (slot-value *object* 'a) 3.5) ;; this works like a charm }}}
but with {{{ (defmethod setslot ((foo foo) val) (setf (slot-value foo 'a) val)) }}}
We have {{{ (setslot *object* 3.5) ;; triggers a type error }}}
#26: slot-value type check ---------------------+------------------------------------------------------ Reporter: rtoy | Owner: rtoy Type: defect | Status: new Priority: minor | Milestone: Component: PCL | Version: 2008-11 Resolution: | Keywords: pcl ---------------------+------------------------------------------------------ Changes (by rtoy):
* owner: somebody => rtoy * component: Core => PCL
#26: slot-value type check ---------------------+------------------------------------------------------ Reporter: rtoy | Owner: rtoy Type: defect | Status: closed Priority: minor | Milestone: Component: PCL | Version: 2008-11 Resolution: fixed | Keywords: pcl ---------------------+------------------------------------------------------ Changes (by rtoy):
* status: new => closed * resolution: => fixed
Comment:
This is now fixed in the 2008-12 snapshot. (setf slot-value) should now signal an error if the new value is not of the correct type. Note that not all cases are handled now, but the common case from the repl works.
{{{pcl::*use-slot-types-p*}}} is also honored in that if it is {{{NIL}}}, the checking is disabled.