Article View: comp.lang.clos
Article #83With-Accessors again
From: Guy Footring
Date: Mon, 13 Apr 1992 16:56
Date: Mon, 13 Apr 1992 16:56
28 lines
1330 bytes
1330 bytes
CLtL2 p777 and p861 says:
"The macro with-accessors can be used to establish a lexical environment
in which specified slots are lexically available through their accessors
as if they were variables. The macro with-accessors invokes the
appropriate accessors to access the specified slots."
However, the syntax of with-accessors doesn't specify slots (except implicitly
by virtue of the accessor presumably reading/writing a slot-value somewhere).
Would the following contrived example (note the complete lack of slots)
be 'legal' CLOS code?
(defclass A ()
())
(defmethod foo ((arg A))
(format t "~&Calling foo on ~A~%" arg)
0)
(defmethod (setf foo) (new-value (arg A))
(format t "~&Calling (setf foo) on ~A with new value ~A~%" arg new-value)
new-value)
(defun bar ()
(let ((A (make-instance 'A)))
(with-accessors ((f foo)) A
(incf f))))
Technical Details
Message-ID:
<19920413165619.5.GUY@AVON.sltd.dialnet.symbolics.com>Path:
arc1-ca.pugleaf.net!sparky!uunet!cis.ohio-state.edu!AVON.sltd.dialnet.symbolics.COM!GuyShow Full Headers
Complete Article Headers
Newsgroups: comp.lang.clos Path: arc1-ca.pugleaf.net!sparky!uunet!cis.ohio-state.edu!AVON.sltd.dialnet.symbolics.COM!Guy From: Guy@AVON.sltd.dialnet.symbolics.COM (Guy Footring) Subject: With-Accessors again Message-ID: <19920413165619.5.GUY@AVON.sltd.dialnet.symbolics.com> Sender: daemon@cis.ohio-state.edu Organization: The Ohio State University Department of Computer and Information Science Date: Mon, 13 Apr 1992 16:56:00 GMT Lines: 28