Article View: comp.lang.clos
Article #75Re: Attempting to circumvent Symbolics' Reader Method
From: Jeff Dalton
Date: Fri, 10 Apr 1992 15:19
Date: Fri, 10 Apr 1992 15:19
30 lines
2074 bytes
2074 bytes
> The idea is that by defining a method on SLOT-VALUE-USING-CLASS you > should be able to affect all accesses to the slots. If the > automatically generated methods don't call SLOT-VALUE this won't work. > In fact, the only reason I know of for SLOT-VALUE being in the language > is to support this. Note that other CLOS-like languages without MOPs > don't have SLOT-VALUE and seem to get along without it. Is it really the only reason? It's certainly not the only thing SLOT-VALUE is used for. People who have just learned CLOS often use SLOT-VALUE almost all the time, because they think it will be more efficient or because it looks like that's what they're supposed to do. But even if we factor out such cases, there are times when SLOT-VALUE seems like the right thing to use. For instance, to do something to all slots one might get a list of the slot names and then use SLOT-VALUE. Indeed, how to do this for structures is one of the most frequent questions about DEFSTRUCT. > Its still possible to do the significant optimization, you just have to > be a little bit more careful. You must notice both that the only > applicable method on the reader generic function is one that is > understood by the implementation and then notice further that the only > applicable method on SLOT-VALUE-USING-CLASS is one that is known to the > implementation. Then you can do the same optimization. You can do an optimization, but don't you have to be able to de-optimize if someone later defines an applicable method on SLOT-VALUE-USING-CLASS? -- jeff
Technical Details
Message-ID:
<17996.9204101519@subnode.aiai.ed.ac.uk>Path:
arc1-ca.pugleaf.net!sparky!uunet!cis.ohio-state.edu!aiai.edinburgh.ac.uk!jeffReferences:
jeff@aiai.edinburgh.ac.uk (Jeff Dalton)Show Full Headers
Complete Article Headers
Newsgroups: comp.lang.clos Path: arc1-ca.pugleaf.net!sparky!uunet!cis.ohio-state.edu!aiai.edinburgh.ac.uk!jeff From: jeff@aiai.edinburgh.ac.uk (Jeff Dalton) Subject: Re: Attempting to circumvent Symbolics' Reader Method Message-ID: <17996.9204101519@subnode.aiai.ed.ac.uk> Sender: daemon@cis.ohio-state.edu Organization: The Ohio State University Department of Computer and Information Science References: jeff@aiai.edinburgh.ac.uk (Jeff Dalton) Date: Fri, 10 Apr 1992 15:19:14 GMT Lines: 31