From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Stefan Monnier via "Bug reports for GNU Emacs, the Swiss army knife of text editors" Newsgroups: gmane.emacs.bugs Subject: bug#52063: 28.0.60; Confusing presentation of lambda Date: Wed, 24 Nov 2021 14:06:37 -0500 Message-ID: References: <83czmqaegb.fsf@gnu.org> <874k82vwe5.fsf@gnus.org> <831r35afde.fsf@gnu.org> <87v90hu36b.fsf@gnus.org> <83v90h8zjw.fsf@gnu.org> <87r1b5u1cl.fsf@gnus.org> <83pmqp8vps.fsf@gnu.org> <87sfvly160.fsf@gnus.org> <83ilwh8pf2.fsf@gnu.org> <83a6ht8n3p.fsf@gnu.org> Reply-To: Stefan Monnier Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="13554"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/29.0.50 (gnu/linux) Cc: larsi@gnus.org, 52063@debbugs.gnu.org To: Eli Zaretskii Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Wed Nov 24 20:14:30 2021 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1mpxiv-0003K0-QK for geb-bug-gnu-emacs@m.gmane-mx.org; Wed, 24 Nov 2021 20:14:30 +0100 Original-Received: from localhost ([::1]:56496 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mpxiu-0004nN-K5 for geb-bug-gnu-emacs@m.gmane-mx.org; Wed, 24 Nov 2021 14:14:28 -0500 Original-Received: from eggs.gnu.org ([209.51.188.92]:56952) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mpxbm-0003wH-Ek for bug-gnu-emacs@gnu.org; Wed, 24 Nov 2021 14:07:06 -0500 Original-Received: from debbugs.gnu.org ([209.51.188.43]:43431) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mpxbi-00071e-N9 for bug-gnu-emacs@gnu.org; Wed, 24 Nov 2021 14:07:06 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1mpxbi-0006SB-G5 for bug-gnu-emacs@gnu.org; Wed, 24 Nov 2021 14:07:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Stefan Monnier Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Wed, 24 Nov 2021 19:07:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 52063 X-GNU-PR-Package: emacs Original-Received: via spool by 52063-submit@debbugs.gnu.org id=B52063.163778080824785 (code B ref 52063); Wed, 24 Nov 2021 19:07:02 +0000 Original-Received: (at 52063) by debbugs.gnu.org; 24 Nov 2021 19:06:48 +0000 Original-Received: from localhost ([127.0.0.1]:54977 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mpxbU-0006Rh-EW for submit@debbugs.gnu.org; Wed, 24 Nov 2021 14:06:48 -0500 Original-Received: from mailscanner.iro.umontreal.ca ([132.204.25.50]:29915) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mpxbR-0006RQ-TM for 52063@debbugs.gnu.org; Wed, 24 Nov 2021 14:06:47 -0500 Original-Received: from pmg3.iro.umontreal.ca (localhost [127.0.0.1]) by pmg3.iro.umontreal.ca (Proxmox) with ESMTP id 56BBF4410DC; Wed, 24 Nov 2021 14:06:40 -0500 (EST) Original-Received: from mail01.iro.umontreal.ca (unknown [172.31.2.1]) by pmg3.iro.umontreal.ca (Proxmox) with ESMTP id DDF924410C8; Wed, 24 Nov 2021 14:06:38 -0500 (EST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=iro.umontreal.ca; s=mail; t=1637780798; bh=Avr6/FPWIS1UHXGZRscx88qcpAlDxUV/ZdPRwKUS87w=; h=From:To:Cc:Subject:References:Date:In-Reply-To:From; b=RNtgY33MzO8yMWmzYAErFjg6xEFtS3wNsFsjvsQYNf4bDP45jjRiaFfEz50n7Ok9V vboG4WR1ZrfrK0zaC6azAxb3OAbGdRlS6M5o0Apsm//tTrAiu4yrMsSXG23WSUSCG4 ksPbvV80iGJB9/wVZyFpg7js2cQ5A7lgz1G0UYlnqA7X2nJuwqN3y2fR8Qy/pdLT2o tzb2VVhhzd9mLEV6zWDfVULaDY3605tVPmQ74/DbZkxsaohlMPuNXZpTz1+QRKEvLx cF/bB4m/L6rgpfbeAXTOo0LGP+d5jdlnsmzc7vQjVWimQZSpdPAS4ImEnKls5Mo2fS 7zXTKlL/PBenw== Original-Received: from pastel (unknown [216.154.30.173]) by mail01.iro.umontreal.ca (Postfix) with ESMTPSA id AEB1E1201D8; Wed, 24 Nov 2021 14:06:38 -0500 (EST) In-Reply-To: <83a6ht8n3p.fsf@gnu.org> (Eli Zaretskii's message of "Wed, 24 Nov 2021 19:44:42 +0200") X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list 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-mx.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.io gmane.emacs.bugs:220764 Archived-At: >> >> > But perhaps others have other opinions here? >> >> Compile your code and the problem goes away (because you'll never see >> >> (lambda ...) or (closure ...) values, they'll all be >> >> byte-code-functions instead ;-) >> > I don't want to compile my .emacs. >> > Any other words of wisdom before I write this off as another annoyance >> > of lexical-binding, and take care to disable that wherever I can? >> The other word of wisdom is: >> Don't add lambdas to hook. Always name those functions. > So this issue is specific to hooks? No, but in 99% of the cases you won't actually *see* a function value (unless you specifically go looking for it, e.g. with `symbol-function`). One of the cases where you are more likely to see one is if you look at the value of a hook. > I thought add-hook is just a fancy way of consing a list, It is. > but you seem to say that it has some side effects that other > constructs don't? Not really, no. > IOW, would manually consing a list with a lambda-function produce the > same results, Yes. > or would it leave the lambda-function intact? No. A *value* of the form (lambda ARGS . BODY) is a (non-compiled) dynamically-scoped function. Non-compiled statically-scoped function values use the form (closure ENV ARGS . BODY...). So you'll only get a value of the form (lambda ARGS . BODY) if you use the dynamically scoped dialect of ELisp (or if you manually create such a list, e.g. with '(lambda ...) or `(lambda ...) or (list 'lambda ...), etc...). Stefan