(index ("advise" 0) ("unadvise" 1680))
(def (sig (procedure "(advise MODE PROCEDURE ADVISOR [ID])" (id advise))) (p "Adds a \"piece of advice\" to " (tt "PROCEDURE") ". Depending on " (tt "MODE") ", do any of the following:") (ul (li "if " (tt "MODE") " is the symbol " (tt "before") ", every call to " (tt "PROCEDURE") " will invoke the procedure " (tt "ADVISOR") " with a list of the arguments passed to " (tt "PROCEDURE") " before the original procedure is executed.") (li "if " (tt "MODE") " is the symbol " (tt "after") ", every call to " (tt "PROCEDURE") " will invoke the procedure " (tt "ADVISOR") " with a list of the arguments passed to " (tt "PROCEDURE") " after the original procedure is executed.") (li "if " (tt "MODE") " is the symbol " (tt "around") ", every call to " (tt "PROCEDURE") " will invoke the procedure " (tt "ADVISOR") " with the next \"inner\" " (tt "around") " advisor procedure (or the original procedure, if no other " (tt "around") " advice is defined or remaining) and a list of the arguments passed to " (tt "PROCEDURE") ".")) (p (tt "before") " advice-procedures are invoked in the reverse order: the most recently added advisor runs first. " (tt "after") " advice-procedures are invoked in the order in which they are added, the most recent one running last. The most recently added " (tt "around") " advice-procedures is called with the next \"inner\" advice procedure passed as argument.") (p "The procedure passed as first argument to " (tt "around") " advisors takes its arguments in the same manner as the original procedure.") (p (tt "advise") " returns an " (tt "ID") " that can be used to identify a particular piece of advice. If no ID was given, one will be generated."))
(def (sig (procedure "(unadvise PROCEDURE [ID [MODE]])" (id unadvise))) (p "Removes advice from an advised procedure. Advice can be removed completely (no ID or mode given). Specific pieces of advice can be removed by passing the advice-ID (as returned by " (tt "advice") "). Alternatively advice for a given mode (" (tt "before") ", " (tt "after") " or " (tt "around") ") can be removed (by passing " (tt "#f") " as the " (tt "ID") " argument)."))
