[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#33199: lambda forms are not self-quoting
From: |
Noam Postavsky |
Subject: |
bug#33199: lambda forms are not self-quoting |
Date: |
Mon, 29 Oct 2018 19:06:25 -0400 |
X-Debbugs-Cc: Garreau, Alexandre <galex-713@galex-713.eu>
Tags: patch
Severity: minor
Alexandre's recent post about pcase-lambda made me notice that lambda's
docstring claims lambda forms are self-quoting. However, they are not:
;; -*- lexical-binding: t -*-
(setq lexical-binding t) ; for *scratch*
(lambda (x) (+ 1 x)) ;=> (closure (t) (x) (+ 1 x))
>From f816c64bf2fe59fc3c77a45d828aea06599f346a Mon Sep 17 00:00:00 2001
From: Noam Postavsky <npostavs@gmail.com>
Date: Mon, 29 Oct 2018 19:01:07 -0400
Subject: [PATCH v1] Don't claim lambda forms are self-quoting
* doc/lispref/functions.texi (Anonymous Functions):
* lisp/subr.el (lambda): Don't say that a lambda form yields itself,
under lexical binding it yields a closure object.
---
doc/lispref/functions.texi | 13 ++-----------
lisp/subr.el | 10 ++++------
2 files changed, 6 insertions(+), 17 deletions(-)
diff --git a/doc/lispref/functions.texi b/doc/lispref/functions.texi
index 9b8057080e..09e43621e4 100644
--- a/doc/lispref/functions.texi
+++ b/doc/lispref/functions.texi
@@ -1082,17 +1082,8 @@ Anonymous Functions
@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:
-
-@example
-(lambda (x) (* x x))
- @result{} (lambda (x) (* x x))
-@end example
-
-The @code{lambda} form has one other effect: it tells the Emacs
-evaluator and byte-compiler that its argument is a function, by using
+The @code{lambda} form has one effect: it tells the Emacs evaluator
+and byte-compiler that its argument is a function, by using
@code{function} as a subroutine (see below).
@end defmac
diff --git a/lisp/subr.el b/lisp/subr.el
index 59f6949b21..1fc58d0ce3 100644
--- a/lisp/subr.el
+++ b/lisp/subr.el
@@ -93,12 +93,10 @@ def-edebug-spec
`(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.
+A call of the form (lambda ARGS DOCSTRING INTERACTIVE BODY) evaluates
+to 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.
--
2.11.0
- bug#33199: lambda forms are not self-quoting,
Noam Postavsky <=