Re: using 2 or more arguments in a setf method
- From: Drew Crampsie <drew.crampsie@xxxxxxxxx>
- Date: Sun, 30 Dec 2007 15:06:39 -0800 (PST)
On Dec 30, 2:39 pm, Joost Diepenmaat <jo...@xxxxxxxxx> wrote:
[snip]
I tried the following in SBCL:
(defmethod (setf input-buffer) (buffer (patch my-class) key)
(setf (getf (input-buffers patch) key) buffer))
But that gives me an error:
The generic function
#<STANDARD-GENERIC-FUNCTION (SETF INPUT-BUFFER) (2)> takes 2
required arguments; was asked to find a method with specializers
(#1=#<BUILT-IN-CLASS T> #<STANDARD-CLASS LADSPA-PATCH> #1#)
[Condition of type SB-PCL::FIND-METHOD-LENGTH-MISMATCH]
See also:
Common Lisp Hyperspec, FIND-METHOD [:function]
As far as I can make out, that seems to indicate that you can't setf
on a method that takes more than one argument.
You didn't make out far enough. This error indicates that the generic
function (SETF INPUT-BUFFER) is already defined with less arguments
than in your method definition. You've probably defined an accessor
somewhere, like in the definition of one of your class's slots.
* (defmethod (setf input-buffer) (val (class t) thing otherthing &rest
things)
(declare (ignore thing otherthing things))
t)
#<STANDARD-METHOD (SETF INPUT-BUFFER) (T T T T) {9493EA9}>
hth,
drewc
It does work if I use a normal method instead of a setf method but I
don't think it's as nice to look at when I can use setf in other places:
(defmethod set-input-buffer ((patch my-class) key buffer)
(setf (getf (input-buffers patch) key) buffer))
Is there any way I can get the setf version to work?
Joost.
.
- Follow-Ups:
- SOLVED - Re: using 2 or more arguments in a setf method
- From: Joost Diepenmaat
- SOLVED - Re: using 2 or more arguments in a setf method
- References:
- using 2 or more arguments in a setf method
- From: Joost Diepenmaat
- using 2 or more arguments in a setf method
- Prev by Date: using 2 or more arguments in a setf method
- Next by Date: SOLVED - Re: using 2 or more arguments in a setf method
- Previous by thread: using 2 or more arguments in a setf method
- Next by thread: SOLVED - Re: using 2 or more arguments in a setf method
- Index(es):
Relevant Pages
|