]> git.eshelyaron.com Git - emacs.git/commitdiff
Note that lex bound lambda forms are not self-quoting (Bug#33199)
authorNoam Postavsky <npostavs@gmail.com>
Mon, 29 Oct 2018 23:01:07 +0000 (19:01 -0400)
committerNoam Postavsky <npostavs@gmail.com>
Fri, 9 Nov 2018 01:13:56 +0000 (20:13 -0500)
* doc/lispref/functions.texi (Anonymous Functions):
* lisp/subr.el (lambda): Note that under lexical binding a lambda form
yields a closure object (Bug#33199).

doc/lispref/functions.texi
lisp/subr.el

index 242d754dea90bb8d5504aefab0c01cb3d627a2e2..216666c713acfc76e992235b0f60ec642ec06836 100644 (file)
@@ -1082,15 +1082,18 @@ This macro returns an anonymous function with argument list
 @var{args}, documentation string @var{doc} (if any), interactive spec
 @var{interactive} (if any), and body forms given by @var{body}.
 
-In effect, this macro makes @code{lambda} forms self-quoting:
-evaluating a form whose @sc{car} is @code{lambda} yields the form
-itself:
+Under dynamic binding, this macro effectively makes @code{lambda}
+forms self-quoting: evaluating a form whose @sc{car} is @code{lambda}
+yields the form itself:
 
 @example
 (lambda (x) (* x x))
      @result{} (lambda (x) (* x x))
 @end example
 
+Note that when evaluting under lexical binding the result is a closure
+object (@pxref{Closures}).
+
 The @code{lambda} form has one other effect: it tells the Emacs
 evaluator and byte-compiler that its argument is a function, by using
 @code{function} as a subroutine (see below).
index 59f6949b2115e108e5470245874e30d59b0f14d9..d09789340fc34e6ef137272219a81f7cc8d64811 100644 (file)
@@ -93,12 +93,13 @@ Info node `(elisp)Specification List' for details."
   `(put (quote ,symbol) 'edebug-form-spec (quote ,spec)))
 
 (defmacro lambda (&rest cdr)
-  "Return a lambda expression.
-A call of the form (lambda ARGS DOCSTRING INTERACTIVE BODY) is
-self-quoting; the result of evaluating the lambda expression is the
-expression itself.  The lambda expression may then be treated as a
-function, i.e., stored as the function value of a symbol, passed to
-`funcall' or `mapcar', etc.
+  "Return an anonymous function.
+Under dynamic binding, a call of the form (lambda ARGS DOCSTRING
+INTERACTIVE BODY) is self-quoting; the result of evaluating the
+lambda expression is the expression itself.  Under lexical
+binding, the result is a closure.  Regardless, the result is a
+function, i.e., it may be stored as the function value of a
+symbol, passed to `funcall' or `mapcar', etc.
 
 ARGS should take the same form as an argument list for a `defun'.
 DOCSTRING is an optional documentation string.