Article View: comp.lang.clos
Article #79Re: CLOS With-Accessors
From: Douglas S. Rand
Date: Fri, 10 Apr 1992 20:59
Date: Fri, 10 Apr 1992 20:59
36 lines
2439 bytes
2439 bytes
In article <19920410191337.6.BARMAR@occam.think.com> barmar@think.com (Barry Margolin) writes:
...
> spec, which say that WITH-ACCESSORS is equivalent to a use of
> SYMBOL-MACROLET that replaces the "variable" references with calls to
> the specified accessor. Why should this SYMBOL-MACROLET expansion be
> dependent on how the accessor is defined?
Don't look at me, I never understood what this sentence is trying to say.
However, if I was forced to guess, I would guess that the sentence from
CLtL2 means that with-accessors is only a syntactic transformation: it
will generate calls to some functions but it won't define the functions
if they aren't already defined. You still have to use :accessor or
:reader or :writer in your defclass, even if you never directly write
calls to the functions defined there in your program, but only use
them indirectly via with-accessors.
That's a possible interpretation. That's certainly what I *thought* we
intended to require.
There is a problem with that interpretation though. with-slots allows
the access (read and write) to slots regardless of the definition
of appropriate access methods, I can easily imagine that
with-accessors should do the same except with a functional style
in place of a variable style.
IMHO, orthogonal design should hold excepting cases where it breaks
existing code, so either with-slots should require :reader, :writer,
:accessor definitions or with-accessors should not require :r, :w, :a.
--
Douglas S. Rand
Internet: <dsrand@mitre.org>
Snail: MITRE, Burlington Road, Bedford, MA
Disclaimer: MITRE might agree with me - then again...
Amateur Radio: KC1KJ
Technical Details
Message-ID:
<DSR.92Apr10155932@chickpea.mitre.org>Path:
arc1-ca.pugleaf.net!sparky!news.UU.NET!usc!zaphod.mps.ohio-state.edu!magnus.acs.ohio-state.edu!usenet.ins.cwru.edu!agate!linus!linus.mitre.org!linus!mbunix!dsrReferences:
<9204101844.AA08001@cambridge.apple.com> <19920410191337.6.BARMAR@occam.think.com>Show Full Headers
Complete Article Headers
Newsgroups: comp.lang.clos Path: arc1-ca.pugleaf.net!sparky!news.UU.NET!usc!zaphod.mps.ohio-state.edu!magnus.acs.ohio-state.edu!usenet.ins.cwru.edu!agate!linus!linus.mitre.org!linus!mbunix!dsr From: dsr@chickpea.mitre.org (Douglas S. Rand) Subject: Re: CLOS With-Accessors In-Reply-To: barmar@think.com's message of Fri, 10 Apr 1992 11:13:00 GMT Message-ID: <DSR.92Apr10155932@chickpea.mitre.org> Sender: news@linus.mitre.org (News Service) Nntp-Posting-Host: chickpea.mitre.org Organization: The MITRE Corporation References: <9204101844.AA08001@cambridge.apple.com> <19920410191337.6.BARMAR@occam.think.com> Date: Fri, 10 Apr 1992 20:59:32 GMT Lines: 36