Commit 88ed9e87 authored by Stefan Monnier's avatar Stefan Monnier
Browse files

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

* doc/lispref/functions.texi (Simple Lambda, Argument List):
* doc/lispref/eval.texi (Function Indirection): Avoid deprecated form.
parent 1a72be46
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:
......
......@@ -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.
......
......@@ -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
......
......@@ -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.
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment