From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Constantin Kulikov Newsgroups: gmane.emacs.devel Subject: Re: Lambda in macrolet becomes a closure? (another breaking change in emacs:)) Date: Fri, 23 Sep 2016 20:19:36 +0300 Message-ID: References: NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: multipart/alternative; boundary=94eb2c05bfc69066ee053d2ffb1b X-Trace: blaine.gmane.org 1474651238 30235 195.159.176.226 (23 Sep 2016 17:20:38 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Fri, 23 Sep 2016 17:20:38 +0000 (UTC) To: emacs-devel , Stefan Monnier Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Fri Sep 23 19:20:35 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 1bnU9G-0006ya-8o for ged-emacs-devel@m.gmane.org; Fri, 23 Sep 2016 19:20:30 +0200 Original-Received: from localhost ([::1]:48866 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bnU9E-0001Re-Ft for ged-emacs-devel@m.gmane.org; Fri, 23 Sep 2016 13:20:28 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:56026) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bnU8T-0001JU-4x for emacs-devel@gnu.org; Fri, 23 Sep 2016 13:19:42 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bnU8R-0003Sf-2q for emacs-devel@gnu.org; Fri, 23 Sep 2016 13:19:40 -0400 Original-Received: from mail-it0-x232.google.com ([2607:f8b0:4001:c0b::232]:38586) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bnU8Q-0003Rm-T0 for emacs-devel@gnu.org; Fri, 23 Sep 2016 13:19:39 -0400 Original-Received: by mail-it0-x232.google.com with SMTP id n143so21727357ita.1 for ; Fri, 23 Sep 2016 10:19:37 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:from:date:message-id:subject:to; bh=vgiGHgyWtnK2vRBOytoS7nMAtkAfGVOs3uts18H8cP8=; b=QflVddRAQ2TiuSH5gT+ApuMKeTS0B8j7GllaIABAETSYSSriF0aO/DsmcIPC5pFiuW +MJC9HgsAp+4Z9unJ1Ia5W4M+H9D4cpKCI80aguCfhkNM7UXLcYUS0yKJy/X6D0nv4R+ DCAdMZ2UrlL03XF1gB//FGuTaCY5Q2U1RsZxcEP3BYu0PGZzJFJiuSgEt7y9au3HOb6O zgzQB7WEATrvSZSaN3bPSTAq3Gz5XYEokNdq8qwzaHWakE5hbZkHIGcnw4futhxcCfJe 4y58URG9TLajcDyW5aRbgFN+/i5agvP16IOzenpxsilarJg871BnRJ5p7hRstMrkeF+q eqNA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to; bh=vgiGHgyWtnK2vRBOytoS7nMAtkAfGVOs3uts18H8cP8=; b=OEzmC6Sk+2kKDBejybGHCyCLB1A5cGjdXz5SftjwZNOTrgMsNgvocOAZ3acXqyT50y FIQdo2Uz502gQ2n7M3LJ3Ib1Vf+4VweEekaJ6XhDCXGYdxiMI0OgFjZb2oiNz0k55QOs D7RSHIbhBqSkNX2WNmrl3rLxOxTbMh0SquYuHhb0dmBw8z1SgSNws1ANrhvT5LSniKgH KvucwWt5o4Uz4b78bYUTfAe2WFwW7ZYL2R8R4DD+jEddYmuTagb7kV7AwxBaEHONhcb5 8kMkrn6i582vtptxpkmEQo2H0yP3SWGyCHbbVYpoCi2i0mmCMHmp8Qz/PNtdGv336jZq cw2A== X-Gm-Message-State: AA6/9RnC0Bb4WU2H5rph2aDez6mW/pRCbpyDvQ5IT6/1E0RkuNB88dxsEH089jm+1Efdn1nZJVTcCWFrKUjUew== X-Received: by 10.36.137.9 with SMTP id s9mr4435530itd.58.1474651176852; Fri, 23 Sep 2016 10:19:36 -0700 (PDT) Original-Received: by 10.79.12.213 with HTTP; Fri, 23 Sep 2016 10:19:36 -0700 (PDT) In-Reply-To: X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 2607:f8b0:4001:c0b::232 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:207742 Archived-At: --94eb2c05bfc69066ee053d2ffb1b Content-Type: text/plain; charset=UTF-8 Thanks for the explanation. However: > To quote a value, you want to use `quote` rather than `function`. I tried something different: (setq lexical-binding t) (let ((var 1)) (let* ((fu #'(lambda (a) (+ a var))) ba) (message "%s" `,fu) (setq ba (byte-compile `(lambda (b) (funcall (quote ,fu) b)))) (funcall ba 2))) and it seems to work well, but (setq lexical-binding nil) (let* ((fu #'(lambda (a) (+ a 1))) ba) (message "%s" `,fu) (let (byte-compile-warnings) (setq ba (byte-compile `(lambda (b) (funcall (quote ,fu) b))))) (funcall ba 2)) results in a *Compile-Log* buffer pop up with Warning: (lambda (a) ...) quoted with ' rather than with #' So (if I understend correctly) I can not predict that the value of the `fu' will be a (closure ...) or a (lambda ...), then how I can decide how to quote this value or silence the warning? --94eb2c05bfc69066ee053d2ffb1b Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable
Thanks for the explanation.

However:

> To quote a value, you= want to use=C2=A0`quote` rather than = `function`.=C2=A0

I tried something different:

(= setq lexical-binding t)
(let ((var 1))
=C2=A0 =C2=A0 =C2=A0 =C2=A0 (let* ((fu #'(lambda (a) (+ a var)))
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0ba)
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 (message &= quot;%s" `,fu)
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0(setq ba (byte-compile `(lambda (b) (funcall (quote ,fu) b))))
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0(funcall ba 2)))
<= div class=3D"gmail_extra">
and it seems= to work well, =C2=A0but=C2=A0

(= setq lexical-binding nil)
(let= * ((fu #'(lambda (a) (+ a 1)))
=C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0ba)
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 (message "%s" `,fu)
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 (let (byt= e-compile-warnings)
=C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0(setq ba (byte-compile `(lambda (b) (funcall (quote ,fu= ) b)))))
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0= (funcall ba 2))

=C2=A0results in a *Compile-Log* buff= er pop up with

Warn= ing: (lambda (a) ...) quoted with ' rather than with #'
=

<= div class=3D"gmail_extra">So (if I understend correctly) I can not predict = that the value of the `fu' will be a (closure ...) or a (lambda ...), t= hen how I can decide how to quote this value or silence the warning?<= /div> --94eb2c05bfc69066ee053d2ffb1b--