When slots :type are used

Didier Verna <[email protected]>
Newsgroups gmane.lisp.cmucl.general
Message-ID <[email protected]>
       Hi again,

Section "2.23.2 Slot Type Checking" continues to puzzle me, especially
the fact that you have to be within *methods* for the :type slot option
to be taken in consideration when writing something to a slot. For
instance, with:

(defclass foo ()
  ((a :type fixnum)))

(defvar *object* (make-instance 'foo))
(setf (slot-value *object* 'a) 3.5)    ;; this works like a charm


but: 

(defmethod setslot ((foo foo) val)
    (setf (slot-value foo 'a) val))

(setslot *object* 3.5) ;; triggers a type error


Can somebody provide a rationale for this ??

Thanks.

-- 
Resistance is futile. You will be jazzimilated.

Scientific site:   http://www.lrde.epita.fr/~didier
Music (Jazz) site: http://www.didierverna.com

EPITA/LRDE, 14-16 rue Voltaire, 94276 Le Kremlin-Bicêtre, France
Tel. +33 (0)1 44 08 01 85       Fax. +33 (0)1 53 14 59 22
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.