From: Wendall M. <wam...@sp...> - 2005-04-09 23:11:32
|
I'll try to keep this short and sweet. One portion of the 7.7 description of define-method-combination states: "It is also possible to bypass the method group specifier mechanism and do everything in the body forms. This is accomplished by writing a single method group with * as its only qualifier-pattern; the variable is then bound to a list of all of the applicable methods, in most-specific-first order." Attempting to do this by rolling your own version of the standard method combination fails in sbcl (as well as cmucl and acl) with an error like: debugger invoked on a SB-PCL::LONG-METHOD-COMBINATION-ERROR in thread 18371: More than one method of type ALL-METHODS with the same specializers. See also: The ANSI Standard, Macro DEFINE-METHOD-COMBINATION This error is thrown before the body has a chance to resolve anything. Lispworks and anecdotally MCL work fine. Another section of the same 7.7 define-method-combination states: "Normally the two methods play different roles in the effective method because they have different qualifiers, and no matter how they are ordered in the result of Step 2, the effective method is the same. If the two methods play the same role and their order matters, an error is signaled. This happens as part of the qualifier pattern matching in define-method-combination." So, I split the difference. define-method-combination with exactly one method group whose qualifier-pattern is * allows you to do whatever you'd like in the body, as the first portion states - allowing full control. Everything else throws this error, as the second portion would seem to indicate. Patch is attached, and I'm willing to change it if it's not the right fix. (I have code that wants to do whatever I told it to do, rather than dying before it has the chance ;)) Thanks, Wendall |