Next: Computed Methods, Previous: Method Syntax, Up: Methods [Contents][Index]
Sometimes it is useful to have a method that adds functionality to existing methods. Chained methods provide a mechanism to accomplish this. A chained method, when invoked, can call the method that would have been called had this method not been defined: it is passed a procedure that will call the inherited method. The chained method can run arbitrary code both before and after calling the inherited method.
Create and return a chained method. Procedure must be a procedure of one argument that returns a procedure. When the chained method is combined, its procedure will be called with one argument, a “call-next-method” procedure; it must then return another procedure that will be called when the method is invoked. The “call-next-method” procedure may called by the method procedure at any time, which will invoke the next less-specific method. The “call-next-method” procedure must be called with the same number of arguments as the method procedure; normally these are the same arguments, but that is not required.
Returns #t
if object is a chained method, otherwise returns
#f
. Note that every chained method satisfies method?
.