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

call-next-method and arguments to :before and :after methods



The CLOS spec is surprisingly silent about the arguments to be passed
to :before and :after methods.  There are several possibilities.  It
seems to me that the current PCL (AAAI) implements the least sensible
of these possiblities.

Specifically, there are (at least) three possibilities:

1.  :before and :after methods always get the original arguments,
i.e., the arguments passed to the initial generic function call.
(This implies that call-next-method cannot be used to modify the
arguments to :before and :after methods.)

2. :before methods get the same arguments as will be passed to the
most specific applicable primary method and :after methods get passed
the same arguments as were passed to the least specific applicable
primary method.  (This way call-next-method in an :around method can
be used to change the arguments to subsequent :before methods [as well
as :after methods], while call-next-method in a primary method can be
used to change the arguments to subsequent :after methods.)

3. Both :before and :after methods get passed the same arguments that
will be passed to the most specific applicable primary method.  (In
other words, call-next-method in the primary methods cannot be used to
modify the arguments passed to :after methods.  However,
call-next-method in :around methods can be used to modify the
arguments to both :before and :after methods.)

PCL implements the third of these, which seem like the least sensoible
choice to me.  I would vote for #2, but realize that #1 is probably
the cleanest choice.

What's the story here, both with respect to the lack of information in
the CLOS spec and with respect to the choice made in the current PCL?

-- Frank

------------------------------------

Frank Halasz          
MCC Software Technology
9390 Research Blvd
Austin TX 78759.
[512]338-3648 

halasz@MCC.COM
or {harvard,ihnp4,nike,seismo}!ut-sally!im4u!milano!halasz