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

DEFMETHOD compile-time processing

In the Meta Object Protocol draft number 10 [89-003], on page 3-16 it says
  "At compile time: ... (5) The method function is computed by
  evaluating the special form (FUNCTION <lambda>) in the lexical
  environment of the DEFMETHOD.  ...  (7) The function ADD-METHOD is
  called ..."

This isn't going to work.  You can install the function at load
time in its lexical environment, or you can install it at compile time in
the null lexical environment, but you can't evaluate something at
compile-time in its run-time lexical environment.

Possible remedies include:

 * Do the compile-time call to ADD-METHOD only if the DEFMETHOD appears at
   top-level in a null lexical environment.  This would be consistent with
   the treatment of DEFMACRO in proposal DEFINING-MACROS-NON-TOP-LEVEL.

 * Don't ever do a compile-time call to ADD-METHOD.  I haven't seen a
   reason why methods would need to be installed in the compile-time
   environment.  Apparently at least some information about generic
   function definitions needs to be remembered for use when invoking
   MAKE-METHOD-LAMBDA, but that wouldn't require being able to actually
   call the generic function at compile-time.