🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.lang.clos
Article #82

Re: CLOS With-Accessors

#82
From: David A. Moon
Date: Mon, 13 Apr 1992 14:57
41 lines
2429 bytes
I'll answer since you sent this specifically to me, although I'm not sure
I can shed any light on your questions.

> Date: Mon, 13 Apr 1992 09:52-0000
> From: Guy Footring <Guy@AVON.sltd.dialnet.symbolics.com>
>     > The second quote has me even more confused.  It may be intended just to
>     > restate the restriction in the first quote.  This sense of the term
>     > "accessor" is never defined precisely in the standard
> 
> I think that this is my main problem for my first query.  I got the feeling
> that "accessor" was refering to accessors defined by DEFCLASS not (necessarily)
> user supplied equivalents, but I couldn't quite find anything that clarified 
> this definitively for either interpretation.

Don't look at me, I never understood what that sentence is trying to say.

> Now I'm back to my first question again, which I guess can be summarised as
> "Is there anything special about the accessors defined by DEFCLASS?"

Yes and no.  (I bet you find that real helpful!)

A user is supposed to be able to get exactly the same effect writing out
accessors explicitly using DEFMETHOD and SLOT-VALUE.  However, many 
implementations implement DEFCLASS-generated accessors more efficiently in space 
and/or speed than they implement ones written out explicitly by the user.  Also 
in implementations with a metaobject protocol the class of the method metaobject 
for an accessor method is usually different from the class of a user-defined 
method.  However, this is outside the scope of the Common Lisp standard.

> A related question: Are the following two DEFCLASS forms guaranteed to be 
> equivalent in all conforming Lisp implementations?
> 
> (defclass A ()
>   ((slot1 :accessor slot1)))
> 
> (defclass A ()
>   ((slot1 :reader slot1 :writer (setf slot1))))

Yes.  This can be inferred from the specifications of the :accessor, :reader, and 
:writer slot-options.  All three of these slot options create "accessor methods."  
:accessor is just an abbreviation.
Technical Details
Message-ID: <9204131451.AA08195@cambridge.apple.com>
Path: arc1-ca.pugleaf.net!sparky!uunet!cis.ohio-state.edu!cambridge.apple.com!moon

Show Full Headers
Complete Article Headers
Newsgroups: comp.lang.clos
Path: arc1-ca.pugleaf.net!sparky!uunet!cis.ohio-state.edu!cambridge.apple.com!moon
From: moon@cambridge.apple.com (David A. Moon)
Subject: Re: CLOS With-Accessors
Message-ID: <9204131451.AA08195@cambridge.apple.com>
Sender: daemon@cis.ohio-state.edu
Organization: The Ohio State University Department of Computer and Information Science
Date: Mon, 13 Apr 1992 14:57:47 GMT
Lines: 41