Jacek Grzebyta
11/27/2015 11:34:00 PM
Kaz Kylheku <kaz@kylheku.com> writes:
> On 2015-11-25, Rob Warnock <rpw3@rpw3.org> wrote:
>> Kalle Olavi Niemitalo <kon@iki.fi> wrote:
>> +---------------
>>| rpw3@rpw3.org (Rob Warnock) writes:
>>| > 3. DEFINE-SETF-EXPANDER is the most complex to use, but
>>| > can do *anything* that a SETF can do, including cases
>>| > that need to do complex destructering of the arguments.
>>|
>>| (defun (setf FOO) ...) supports (setf (apply #'FOO ...) VALUE)
>>| but (define-set-expander FOO ...) cannot do that. The setf
>>| expander has so much control over the arguments that there is not
>>| enough left for APPLY.
>>|
>>| Related: <news:87y8i1yjus.fsf@Astalo.kon.iki.fi> from 20 Oct 2004.
>> +---------------
>>
>> Thanks!! Your list comparing macros, (SETF foo) functions,
>> short DEFSETF, long DEFSETF, and DEFINE-SETF-EXPANDER was
>> *much* more extensive than mine.
>>
>> Jacek, you should go read Kalle's article, too. [Yes, it's
>> still accessible in Google Groups, if you bash on the search
>> function hard enough! ;-} ] His bottom line:
>>
>> I have been using setf functions and DEFINE-SETF-EXPANDER
>> but not DEFSETF. If I have understood the features of
>> DEFSETF correctly, the short form of DEFSETF has no
>> advantages over a setf function, and the long form of
>> DEFSETF is only useful if you are defining a place where
>> multiple values can be stored.
>
> The advantage of defsetf is that it uses an any function you want for the store
> form. If you have such a function already, chances are it's not called
> (setf whatever). You don't have to write an additional function which
> duplicates or wraps it.
Thanks a lot to everyone. I see Common Lisp is more like human language
learning: There are quite simple basic rules and complex tips, tricks and
nuances.
Jacek Grzebyta