From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Stefan Monnier Newsgroups: gmane.emacs.devel Subject: Re: Lambda in macrolet becomes a closure? (another breaking change in emacs:)) Date: Mon, 19 Sep 2016 14:12:17 -0400 Message-ID: References: NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Trace: blaine.gmane.org 1474309140 6413 195.159.176.226 (19 Sep 2016 18:19:00 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Mon, 19 Sep 2016 18:19:00 +0000 (UTC) User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.1.50 (gnu/linux) To: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Mon Sep 19 20:18:57 2016 Return-path: Envelope-to: ged-emacs-devel@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 1bm39X-0000eJ-6x for ged-emacs-devel@m.gmane.org; Mon, 19 Sep 2016 20:18:51 +0200 Original-Received: from localhost ([::1]:57447 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bm39V-0007yf-5T for ged-emacs-devel@m.gmane.org; Mon, 19 Sep 2016 14:18:49 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:39314) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bm33i-0004KV-Cx for emacs-devel@gnu.org; Mon, 19 Sep 2016 14:12:51 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bm33f-0001D9-7I for emacs-devel@gnu.org; Mon, 19 Sep 2016 14:12:50 -0400 Original-Received: from [195.159.176.226] (port=34267 helo=blaine.gmane.org) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bm33f-0001AL-10 for emacs-devel@gnu.org; Mon, 19 Sep 2016 14:12:47 -0400 Original-Received: from list by blaine.gmane.org with local (Exim 4.84_2) (envelope-from ) id 1bm33V-0001rA-1z for emacs-devel@gnu.org; Mon, 19 Sep 2016 20:12:37 +0200 X-Injected-Via-Gmane: http://gmane.org/ Original-Lines: 38 Original-X-Complaints-To: usenet@blaine.gmane.org Cancel-Lock: sha1:TE+5KKk48Hr/GRJft1sAj576akI= X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 195.159.176.226 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Original-Sender: "Emacs-devel" Xref: news.gmane.org gmane.emacs.devel:207619 Archived-At: > in emacs version "25.1.50.2", this: > (macrolet ((tm () (let ((fu #'(lambda () t))) > `(list ,fu)))) > (tm)) Here, `fu' is a function *value*, rather than a function *expression* (where I take those words to mean that an /expression/ is what you pass to `eval` and that returns ` /value/). In `(list ,fu) you take that value and plug it into the source code, which in general might not work correctly (although you may often get lucky since in Elisp, many values are "self-quoting" meaning that they are also valid expressions which evaluate to themselves). > gives an errror: Symbol’s function definition is void: closure Indeed, in a lexical-binding context, a function value will sometimes look like (closure ...) which is not a valid expression (there is no function nor macro named `closure'). > (macrolet ((tm () (let ((fu #'(lambda () t))) > `(list (function ,fu))))) > (tm)) > returns ((closure (t) nil t)) This will sometimes work as well. Probably more often than the previous example. Yet it's still not correct. To quote a value, you want to use `quote` rather than `function`. `function` can only be used reliably to quote a "function expression" rather than a function value. A function expression is basically either a symbol (the name of a function), or a sexp of the form (lambda ). > in emacs "24.3.1", both variants returns ((lambda nil t)) Yes, sometimes. Stefan