From: Gerd M. <ger...@t-...> - 2003-01-23 19:42:35
|
Christophe Rhodes <cs...@ca...> writes: > The second is even harder to pin down, though a priori it looks > obviously wrong; I haven't even been able to construct a test case for > it, even though one such should be easy. Consider the following > fragment from INVOKE-EFFECTIVE-METHOD-FUNCTION (which is much the same > in CMUCL's PCL): > > ,@(when (and (null restp) (= 2 (length required-args+rest-arg))) > `(((typep ,emf 'fixnum) > (let ((.new-value. ,(car required-args+rest-arg)) > (.slots. (get-slots-or-nil > ,(car required-args+rest-arg)))) > (when .slots. > (setf (clos-slots-ref .slots. ,emf) .new-value.)))))) > > We have previously deduced that a FIXNUM representation of an EMF > represents a slot access -- and if the function has two arguments, > this would be a slot set. Correct. > So we do something that gets the slots, and sets the required slot > (encoded in the EMF) to the new value. Um. Except that there's > clearly a typo here, because we are obtaining both the > .NEW-VALUE. and the .SLOTS. variables from the first element of > REQUIRED-ARGS+REST-ARG. I agree it's a bug; the instance is the second parameter. > So, is this dead code? This part of the code is not used for "normal" classes, which use slot accessors created by MAKE-STD-{READER,WRITER,BOUNDP}-METHOD-FUNCTION. (One such function is created for each distinct slot name, and they use the pv table mechanism internally for accessing slots in different classes.) > I can't trigger the bug -- maybe someone else can? I think the code is used for classes whose WRITER-METHOD-CLASS doesn't return STANDARD-WRITER-METHOD, which should prevent the use of the standard writers. Constructing a test case is quite some work, though... |