21 |
* Anonymous Functions:: Lambda expressions are functions with no names. |
* Anonymous Functions:: Lambda expressions are functions with no names. |
22 |
* Function Cells:: Accessing or setting the function definition |
* Function Cells:: Accessing or setting the function definition |
23 |
of a symbol. |
of a symbol. |
24 |
|
* Obsolete Functions:: Declaring functions obsolete. |
25 |
* Inline Functions:: Defining functions that the compiler will open code. |
* Inline Functions:: Defining functions that the compiler will open code. |
26 |
* Function Safety:: Determining whether a function is safe to call. |
* Function Safety:: Determining whether a function is safe to call. |
27 |
* Related Topics:: Cross-references to specific Lisp primitives |
* Related Topics:: Cross-references to specific Lisp primitives |
602 |
|
|
603 |
By contrast, in programs that manipulate function definitions for other |
By contrast, in programs that manipulate function definitions for other |
604 |
purposes, it is better to use @code{fset}, which does not keep such |
purposes, it is better to use @code{fset}, which does not keep such |
605 |
records. |
records. @xref{Function Cells}. |
606 |
@end defun |
@end defun |
607 |
|
|
608 |
You cannot create a new primitive function with @code{defun} or |
You cannot create a new primitive function with @code{defun} or |
1151 |
a function defined by another package, it is cleaner to use |
a function defined by another package, it is cleaner to use |
1152 |
@code{defadvice} (@pxref{Advising Functions}). |
@code{defadvice} (@pxref{Advising Functions}). |
1153 |
|
|
1154 |
|
@node Obsolete Functions |
1155 |
|
@section Declaring Functions Obsolete |
1156 |
|
|
1157 |
|
You can use @code{make-obsolete} to declare a function obsolete. This |
1158 |
|
indicates that the function may be removed at some stage in the future. |
1159 |
|
|
1160 |
|
@defun make-obsolete function new &optional when |
1161 |
|
This function makes the byte compiler warn that the function |
1162 |
|
@var{function} is obsolete. If @var{new} is a symbol, the warning |
1163 |
|
message says to use @var{new} instead of @var{function}. @var{new} |
1164 |
|
does not need to be an alias for @var{function}; it can be a different |
1165 |
|
function with similar functionality. If @var{new} is a string, it is |
1166 |
|
the warning message. |
1167 |
|
|
1168 |
|
If provided, @var{when} should be a string indicating when the function |
1169 |
|
was first made obsolete---for example, a date or a release number. |
1170 |
|
@end defun |
1171 |
|
|
1172 |
|
You can define a function as an alias and declare it obsolete at the |
1173 |
|
same time using the macro @code{define-obsolete-function-alias}. |
1174 |
|
|
1175 |
|
@defmac define-obsolete-function-alias function new &optional when docstring |
1176 |
|
This macro marks the function @var{function} obsolete and also defines |
1177 |
|
it as an alias for the function @var{new}. A typical call has the form: |
1178 |
|
|
1179 |
|
@example |
1180 |
|
(define-obsolete-function-alias 'old-fun 'new-fun "22.1" "Doc.") |
1181 |
|
@end example |
1182 |
|
|
1183 |
|
@noindent |
1184 |
|
which is equivalent to the following two lines of code: |
1185 |
|
|
1186 |
|
@example |
1187 |
|
(defalias 'old-fun 'new-fun "Doc.") |
1188 |
|
(make-obsolete 'old-fun 'new-fun "22.1") |
1189 |
|
@end example |
1190 |
|
@end defmac |
1191 |
|
|
1192 |
@node Inline Functions |
@node Inline Functions |
1193 |
@section Inline Functions |
@section Inline Functions |
1194 |
@cindex inline functions |
@cindex inline functions |
1225 |
following the definition, just like macros. |
following the definition, just like macros. |
1226 |
|
|
1227 |
@node Function Safety |
@node Function Safety |
1228 |
@section Determining whether a function is safe to call |
@section Determining whether a Function is Safe to Call |
1229 |
@cindex function safety |
@cindex function safety |
1230 |
@cindex safety of functions |
@cindex safety of functions |
1231 |
|
|