Module Ecaml.Advice
The "advice" feature lets you add to the existing definition of a function, by wrapping around the original function a "piece of advice".
Each piece of advice receives the original function and arguments; its result is returned to the caller as if from the original function.
A function may have multiple pieces of advice, which are composed by nesting earlier advice within later advice.
(Info-goto-node "(elisp)Advising Functions")
val around_values : Symbol.t -> Core_kernel.Source_code_position.t -> ?docstring:string -> for_function:Symbol.t -> ?interactive:Defun.Interactive.t -> ((Ecaml__.Import.Value.t list -> Ecaml__.Import.Value.t) -> Ecaml__.Import.Value.t list -> Ecaml__.Import.Value.t) -> unit
around_values ?docstring ?interactive here return_type advice_name f ~for_function
defines functionadvice_name
with bodyf
and adds it as advice onfor_function
.Compared to
around_funcall
,around_values
provides looser coupling when the advice doesn't need to interact with the arguments or return value offor_function
.
val around_funcall : Symbol.t -> Core_kernel.Source_code_position.t -> ?docstring:string -> for_function:Symbol.t -> ?interactive:Defun.Interactive.t -> 'a Funcall.t -> ('a -> 'a) -> unit
around_funcall
provides typeful access to the arguments and return value offor_function
.