- advise MODE PROCEDURE ADVISOR #!optional IDprocedure
Adds a "piece of advice" to PROCEDURE. Depending on MODE, do any of the following:
- if MODE is the symbol before, every call to PROCEDURE will invoke the procedure ADVISOR with a list of the arguments passed to PROCEDURE before the original procedure is executed.
- if MODE is the symbol after, every call to PROCEDURE will invoke the procedure ADVISOR with a list of the arguments passed to PROCEDURE after the original procedure is executed.
- if MODE is the symbol around, every call to PROCEDURE will invoke the procedure ADVISOR with the next "inner" around advisor procedure (or the original procedure, if no other around advice is defined or remaining) and a list of the arguments passed to PROCEDURE.
before advice-procedures are invoked in the reverse order: the most recently added advisor runs first. after advice-procedures are invoked in the order in which they are added, the most recent one running last. The most recently added around advice-procedures is called with the next "inner" advice procedure passed as argument.
The procedure passed as first argument to around advisors takes its arguments in the same manner as the original procedure.
advise returns an ID that can be used to identify a particular piece of advice. If no ID was given, one will be generated.