[ < ] [ > ]   [ << ] [Plus haut] [ >> ]         [Top] [Table des matières] [Index] [ ? ]

17.9 Advising Primitives

Advising a primitive function (also called a “subr”) is risky. Some primitive functions are used by the advice mechanism; advising them could cause an infinite recursion. Also, many primitive functions are called directly from C code. Calls to the primitive from Lisp code will take note of the advice, but calls from C code will ignore the advice.

When the advice facility constructs the combined definition, it needs to know the argument list of the original function. This is not always possible for primitive functions. When advice cannot determine the argument list, it uses (&rest ad-subr-args), which always works but is inefficient because it constructs a list of the argument values. You can use ad-define-subr-args to declare the proper argument names for a primitive function:

Function: ad-define-subr-args function arglist

This function specifies that arglist should be used as the argument list for function function.

For example,

 
(ad-define-subr-args 'fset '(sym newdef))

specifies the argument list for the function fset.


Ce document a été généré par Eric Reinbold le 13 Octobre 2007 en utilisant texi2html 1.78.