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

Re: eql-specialized methods and before



> From: "Mark A. Tapia" <markt@dgp.toronto.edu>
> Subject: Re:  eql-specialized methods and before
> 
> On Fri Feb 111994 Bob Hall writes:
> > Is the following a bug, or am I doing something wrong?  It works okay
> > if I don't define the :BEFORE method.
> > 
> > (DEFMETHOD ZOG ((X (EQL :NORJ))) (print "Zognorj!"))
> > (DEFMETHOD ZOG ((X (EQL :BLID))) (PRINT "Zogblid!"))
> > (DEFMETHOD ZOG :BEFORE ((X T)) (PRINT "Before zog"))
> 
> > (ZOG :NORJ)
> 
> >> Error: No applicable primary methods for #<STANDARD-GENERIC-FUNCTION ZOG 
> #x56>
> >>        Applicable methods: (#<STANDARD-METHOD ZOG :BEFORE (T)>)
> >> While executing: CCL::%METHOD-COMBINATION-ERROR
> >> Type Command-. to abort.
> 
> If you're going to use a before, after, or around methods (e.g.
>   (defmethod zog :before ...
>   (defmethod zog :after ...
>   (defmethod zog :around ...
> you'll need to define a primary method The :before method is invoked before
> any other method, the after method after.
> 
> 
> The problems disappear if you add the following
> (defmethod zog ((x t)) 
>         (declare (ignore x)

Actually, the behavior Bob Hall is seeing is in fact a bug, and there's a patch 
for it.  It's a bug because the two EQL specialized methods are both primary 
methods.  The relevant patch is a post 2.0p2 patch called 
"eql-method-comb-patch".  I'm not sure if this patch has been released or if you 
will need to request it.  In the meantime, the workaround of defining a method 
on T might work in the particular application, though it might be better to make 
the dummy default method to signal an error, since presumably it's never 
supposed to actually be reached.