From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Noam Postavsky Newsgroups: gmane.emacs.bugs Subject: bug#33199: lambda forms are not self-quoting Date: Mon, 29 Oct 2018 19:06:25 -0400 Message-ID: <87zhuwic9a.fsf@gmail.com> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-Trace: blaine.gmane.org 1540854314 19342 195.159.176.226 (29 Oct 2018 23:05:14 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Mon, 29 Oct 2018 23:05:14 +0000 (UTC) Cc: garreau@debbugs.gnu.org, alexandre To: 33199@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Tue Oct 30 00:05:10 2018 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1gHGar-0004tm-BC for geb-bug-gnu-emacs@m.gmane.org; Tue, 30 Oct 2018 00:05:09 +0100 Original-Received: from localhost ([::1]:49490 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gHGcx-0003fR-R9 for geb-bug-gnu-emacs@m.gmane.org; Mon, 29 Oct 2018 19:07:19 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:44670) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gHGcl-0003ci-2V for bug-gnu-emacs@gnu.org; Mon, 29 Oct 2018 19:07:07 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gHGch-0000xn-3W for bug-gnu-emacs@gnu.org; Mon, 29 Oct 2018 19:07:07 -0400 Original-Received: from debbugs.gnu.org ([208.118.235.43]:48051) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1gHGcg-0000xh-VK for bug-gnu-emacs@gnu.org; Mon, 29 Oct 2018 19:07:03 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1gHGcg-00057V-EN; Mon, 29 Oct 2018 19:07:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Noam Postavsky Original-Sender: "Debbugs-submit" Resent-CC: garreau@debbugs.gnu.org, galex-713@galex-713.eu, bug-gnu-emacs@gnu.org Resent-Date: Mon, 29 Oct 2018 23:07:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 33199 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch X-Debbugs-Original-To: bug-gnu-emacs@gnu.org X-Debbugs-Original-Xcc: garreau, alexandre Original-Received: via spool by submit@debbugs.gnu.org id=B.154085440719651 (code B ref -1); Mon, 29 Oct 2018 23:07:02 +0000 Original-Received: (at submit) by debbugs.gnu.org; 29 Oct 2018 23:06:47 +0000 Original-Received: from localhost ([127.0.0.1]:52307 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1gHGcQ-00056t-N5 for submit@debbugs.gnu.org; Mon, 29 Oct 2018 19:06:46 -0400 Original-Received: from eggs.gnu.org ([208.118.235.92]:34916) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1gHGcN-00056f-IO for submit@debbugs.gnu.org; Mon, 29 Oct 2018 19:06:45 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gHGcH-0000ix-A9 for submit@debbugs.gnu.org; Mon, 29 Oct 2018 19:06:38 -0400 Original-Received: from lists.gnu.org ([2001:4830:134:3::11]:42493) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gHGcG-0000if-LO for submit@debbugs.gnu.org; Mon, 29 Oct 2018 19:06:37 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:44504) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gHGcF-0003Pk-Cg for bug-gnu-emacs@gnu.org; Mon, 29 Oct 2018 19:06:36 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gHGcA-0000gL-Dv for bug-gnu-emacs@gnu.org; Mon, 29 Oct 2018 19:06:34 -0400 Original-Received: from mail-it1-x129.google.com ([2607:f8b0:4864:20::129]:36468) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1gHGc8-0000fg-8v for bug-gnu-emacs@gnu.org; Mon, 29 Oct 2018 19:06:28 -0400 Original-Received: by mail-it1-x129.google.com with SMTP id t4-v6so3281995itf.1 for ; Mon, 29 Oct 2018 16:06:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:subject:date:message-id:mime-version; bh=7Lc8DWhD7/yhKTkVGJo8VezNHmLdk8ATV6gNbgwDJEw=; b=oZW5QogTt0xfXc4zpctImukpIyJODXvffSC15YHmRwEqZK99CVYcH4ccBo2OInR6wF TIoD7gRjvPkUzkrvkk+q1+U+c7Iw3YFLmW5YCYKItVoJCC68z+KETroDQftKmKJDYipv 6IzeOZ+c3iSBpZNYNzQ0Zt/2AuoZrPoeGEr52CAGWyq+XiiDrrRlESZzCWfV8x45XC2m et8t1aenZK+Iyo21BYOfK1SgHGUSsbQggx38DMx35HDMsffOoJiVVRCNT2eH2AOaLHpv r2j8TEex/ADrHFInZgOTwtN3WnTrI/fbr1FrNXGKSp1YrXL+8v/SHQhH+icIK9pr0ZNx wOvA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:mime-version; bh=7Lc8DWhD7/yhKTkVGJo8VezNHmLdk8ATV6gNbgwDJEw=; b=TCVagPe4IyJlXuUDG4uuCfXCYizMAHvxKNgZs3GgM1JOEhn76gbROT6bHBUW13VYhw OSONI84lEzrzTc5p464qITdk+ZdRbsGaEUOJjX1z88hEfTqG80/muhWNLmwjVhbNBmvI oIcdB6tu6h0iwBjBAWc3q3EElvISbmuayEGGEX5iQ1TYMkOGMX77/rLJHjV494W3E+fu G4WxMyoBlzIsjj98UWmdQx7KqqStz11nUD5YSeOlCvWRVDEmDtcaFUaP7eImrhlBOHKd MDe3SCtu6hZ0zY7tNDDyeYMlnHZsMsByEYhWqDC9WrQfqEYGrcv1yuU2JmXnoIbQGjPj O3ug== X-Gm-Message-State: AGRZ1gKAc0SArlmPzxy0vhf/wdMjtlLxb15ghgQ2EZTGWRrSO/wt+bhF Cp8+QxpB0PT1t39pfTkK6Vp8SsfO X-Google-Smtp-Source: AJdET5c7olEtKzea2FWpWk8sqWSz4QXnpmrlpRMRrdpUkkV2ay1k8gPW5nKTb0gxJX4BZx1zhGwwLQ== X-Received: by 2002:a02:5b88:: with SMTP id g130-v6mr10301220jab.7.1540854387286; Mon, 29 Oct 2018 16:06:27 -0700 (PDT) Original-Received: from zebian (cbl-45-2-119-34.yyz.frontiernetworks.ca. [45.2.119.34]) by smtp.googlemail.com with ESMTPSA id q205-v6sm7963812itc.2.2018.10.29.16.06.26 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 29 Oct 2018 16:06:26 -0700 (PDT) X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 208.118.235.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.org gmane.emacs.bugs:151795 Archived-At: --=-=-= Content-Type: text/plain X-Debbugs-Cc: Garreau, Alexandre 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)) --=-=-= Content-Type: text/x-diff Content-Disposition: inline; filename=v1-0001-Don-t-claim-lambda-forms-are-self-quoting.patch Content-Description: patch >From f816c64bf2fe59fc3c77a45d828aea06599f346a Mon Sep 17 00:00:00 2001 From: Noam Postavsky 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 --=-=-=--