Article View: comp.lang.clos
Article #298Re: setf methods
From: Jeff Dalton
Date: Thu, 12 Nov 1992 19:38
Date: Thu, 12 Nov 1992 19:38
19 lines
1372 bytes
1372 bytes
> When I learned about object oriented programming one of the views that > was taught was that the set of methods of a class should preserve a > set of invariants related to the class. I.e. the object state before > and after a (official or exported) method is run should satisfy a set > of constraints, which of course could be violated while running the > method. This is a good idea, but it's not clear that it should apply to accessors (or readers or writers). (1) It's reasonable to do all slot access via accessors and never use SLOT-VALUE and (2) it's often necessary to make several state changes before you're back in a consistent state. Obviously, there are some, even many, accessors that could be asked to maintain the invariant, but I don't think it can work as a general rule for all public accessors. This sort of thing works better in languages wiht "instance variables", I suspect. -- jd
Technical Details
Message-ID:
<708.9211121938@subnode.aiai.ed.ac.uk>Path:
arc1-ca.pugleaf.net!sparky!uunet!ulowell!news.bbn.com!usc!zaphod.mps.ohio-state.edu!cis.ohio-state.edu!aiai.edinburgh.ac.uk!jeffShow Full Headers
Complete Article Headers
Newsgroups: comp.lang.clos Path: arc1-ca.pugleaf.net!sparky!uunet!ulowell!news.bbn.com!usc!zaphod.mps.ohio-state.edu!cis.ohio-state.edu!aiai.edinburgh.ac.uk!jeff From: jeff@aiai.edinburgh.ac.uk (Jeff Dalton) Subject: Re: setf methods Message-ID: <708.9211121938@subnode.aiai.ed.ac.uk> Sender: daemon@cis.ohio-state.edu Organization: The Ohio State University Department of Computer and Information Science Date: Thu, 12 Nov 1992 19:38:52 GMT Lines: 19