Re: Canonical Way to Mask SETF?
- From: Frode Vatvedt Fjeld <frodef@xxxxxxxxx>
- Date: Thu, 30 Jun 2005 22:05:48 +0200
Robert Uhl <eadmund42@xxxxxxxxxxxxxxx> writes:
> (defun menu-item (menu)
> (getf menu :title))
>
> (defsetf menu-title (menu) (title)
> `(setf (getf ,menu :title) ,title))
>
> But of course it doesn't work. Any advice on how this needs to be
> written?
One possibility is simply:
(defmacro menu-item (menu) `(getf ,menu :title))
Now both the setter and getter should work as expected. You don't get
(function menu-item), but then again there's clearly no way you can
get (function (setf menu-item)), so maybe that's reasonable.
--
Frode Vatvedt Fjeld
.
- References:
- Canonical Way to Mask SETF?
- From: Robert Uhl
- Canonical Way to Mask SETF?
- Prev by Date: Re: Canonical Way to Mask SETF?
- Previous by thread: Re: Canonical Way to Mask SETF?
- Index(es):