1
0
mirror of https://git.savannah.gnu.org/git/emacs.git synced 2024-11-24 07:20:37 +00:00

Deprecate the ((lambda ...) ...) form.

* doc/lispref/functions.texi (Simple Lambda, Argument List):
* doc/lispref/eval.texi (Function Indirection): Avoid deprecated form.
This commit is contained in:
Stefan Monnier 2012-04-25 23:06:36 -04:00
parent 1a72be4624
commit 88ed9e87e5
4 changed files with 36 additions and 14 deletions

View File

@ -1,3 +1,8 @@
2012-04-26 Stefan Monnier <monnier@iro.umontreal.ca>
* functions.texi (Simple Lambda, Argument List):
* eval.texi (Function Indirection): Avoid deprecated form.
2012-04-26 Glenn Morris <rgm@gnu.org>
* book-spine.texi, elisp.texi, vol1.texi, vol2.texi:

View File

@ -305,6 +305,22 @@ function, not a symbol.
Executing the function itself evaluates its body; this does involve
symbol function indirection when calling @code{erste}.
This form is rarely used and is now deprecated. Instead, you should write it
as:
@smallexample
@group
(funcall (lambda (arg) (erste arg))
'(1 2 3))
@end group
@end smallexample
or just
@smallexample
@group
(let ((arg '(1 2 3))) (erste arg))
@end group
@end smallexample
The built-in function @code{indirect-function} provides an easy way to
perform symbol function indirection explicitly.

View File

@ -267,13 +267,12 @@ function is the value returned by the last element of the body.
@end example
@noindent
We can call this function by writing it as the @sc{car} of an
expression, like this:
We can call this function by passing it to @code{funcall}, like this:
@example
@group
((lambda (a b c) (+ a b c))
1 2 3)
(funcall (lambda (a b c) (+ a b c))
1 2 3)
@end group
@end example
@ -288,8 +287,8 @@ this example:
@example
@group
((lambda (a b c) (+ a b c))
1 (* 2 3) (- 5 4))
(funcall (lambda (a b c) (+ a b c))
1 (* 2 3) (- 5 4))
@end group
@end example
@ -400,16 +399,16 @@ after a @code{&rest} argument.
Here are some examples of argument lists and proper calls:
@smallexample
((lambda (n) (1+ n)) ; @r{One required:}
1) ; @r{requires exactly one argument.}
(funcall (lambda (n) (1+ n)) ; @r{One required:}
1) ; @r{requires exactly one argument.}
@result{} 2
((lambda (n &optional n1) ; @r{One required and one optional:}
(if n1 (+ n n1) (1+ n))) ; @r{1 or 2 arguments.}
1 2)
(funcall (lambda (n &optional n1) ; @r{One required and one optional:}
(if n1 (+ n n1) (1+ n))) ; @r{1 or 2 arguments.}
1 2)
@result{} 3
((lambda (n &rest ns) ; @r{One required and one rest:}
(+ n (apply '+ ns))) ; @r{1 or more arguments.}
1 2 3 4 5)
(funcall (lambda (n &rest ns) ; @r{One required and one rest:}
(+ n (apply '+ ns))) ; @r{1 or more arguments.}
1 2 3 4 5)
@result{} 15
@end smallexample

View File

@ -1052,6 +1052,8 @@ So do `defcustom' and other forms that call `defvar' as a subroutine.
*** New function `special-variable-p' to check whether a variable is
declared as dynamically bound.
*** The form ((lambda ...) ...) is deprecated.
** An Emacs Lisp testing tool is now included.
Emacs Lisp developers can use this tool to write automated tests for
their code. See the ERT info manual for details.