[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: CLOS slot access



>What is the fastest way to do slot accesses in CLOS?
>We are using
>	(defclass foo ()
>  (slot1 :initform NIL)
>  ....
>  )
>(:accessor-prefix))

>(defmethod bar ((f foo))
>  (clos::with-slots* (slot1) f
>     (setf slot1 3) ; setting
>     (+ 6 slot1)    ; access
...	    

The latest CLOS specs no longer have an :accessor-prefix class-option and now
include :accessor as a slot option, as well as :reader, :writer and other slot
related stuff.  Therefore, you would use:
	(defclass foo ()
		  ((slot1 :accessor slot1
			  :initform NIL)
		   ...
		   ))

	(defmethod bar ((f foo))
		   ...

--Jeff Hartung--

ARPA - hartung@sdics.ucsd.edu
UUCP - !ucsd!sdics!hartung