All Manuals > LispWorks® User Guide and Reference Manual > 6 The Advice Facility

6.5 Advising subfunctions

Subfunctions are functions that are defined inside the body of other functions rather than by top level defining forms like defun, defmethod, etc. To advise such a subfunction, call defadvice with a "subfunction dspec" of the form:

See 7.6 Subfunction dspecs for details. The rest of the defadvice form has the same effect as when advising ordinary functions.

The behavior when advising a subfunction is somewhat different from advising other functions.

Advising of subfunction works only for compiled code.

6.5.1 Notes on subfunction names

Anonymous lambdas are named by the compiler using integers.

You can find the dspec of a given subfunction by calling object-dspec on the subfunction. You can also construct it from the printed representation of the subfunction, which contains the sub-name and the parent-dspec.

A subfunction can be given an name using a hcl:lambda-name declaration (see declare). If this is of the form (subfunction sub-name), then the dspec of the subfunction will be contain both sub-name and the correct parent-dspec. However, if it has any other form, then dspec will be that name and you will need to know the parent-dspec in order to construct the subfunction dspec.


LispWorks® User Guide and Reference Manual - 01 Dec 2021 19:30:18