A generic function that can be implemented to modify the first argument to the invoke-callback in simple-i-dispatch.
( this simple-i-dispatch) => this
The generic function
simple-i-dispatch-callback-object
is called by the implementation of simple-i-dispatch to obtain the callback object (first argument) to its
invoke-callback
. This allows the object to be computed in some way by subclassing simple-i-dispatch and implementing a method on
simple-i-dispatch-callback-object
specialized for the subclass.
The pre-defined primary method specializing on simple-i-dispatch always returns its argument.
When the function
my-dispatch-callback
below is called, its first argument will be the
useful-object
passed to
make-my-dispatch
.
(defclass my-dispatch (simple-i-dispatch)
((useful-object :initarg :useful-object)))
(defmethod simple-i-dispatch-callback-object
((this my-dispatch))
(slot-value this 'useful-object))
(defun make-my-dispatch (useful-object)
(make-instance
'my-dispatch
:useful-object useful-object
:invoke-callback 'my-dispatch-callback
:interface-name "MyDispatchInterface"))