[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

EXPAND-DEFMETHOD-INTERNAL bug



In looking at Mike Thome's improvements on the TOP-LEVEL-FORM stuff
(posted by Andreas Girgensohn), I noticed a potential bug.  The bug is
actually present in the original version of EXPAND-DEFMETHOD-INTERNAL
in Rainy Day and May Day PCLs, as well as the modified version. 
EXPAND-DEFMETHOD-INTERNAL incorrectly expands method definitions
of the form 

  (DEFMETHOD BLOOP (X Y Z)
    <some code>
    (CALL-NEXT-METHOD)
    <some more code>
    (CALL-NEXT-METHOD X Y Z)
    <yet more code>
    )

EXPAND-DEFMETHOD-INTERNAL's walker function basically takes the last
call to CALL-NEXT-METHOD as the indicator for whether or not
CALL-NEXT-METHOD is invoked in the no argument situation.  Thus the
first CALL-NEXT-METHOD in the BLOOP method breaks, because the
internal function has been defined in the expansion so as to insist
on arguments.

The fix should be made to the function EXPAND-DEFMETHOD-INTERNAL, in
BOOT.LISP.  The function is 90+ lines long, so I won't reproduce it
all here.  Inside the FLET of WALK-FUNCTION, the form

  (SETQ SAVE-ORIGINAL-ARGS (NOT (CDR FORM)))

should be replaced by

  (UNLESS (REST FORM)
    (SETF SAVE-ORIGINAL-ARGS T))