From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Newsgroups: gmane.emacs.help Subject: Re: How do I pass a variable defined in a wrapping let, to a lambda? Date: Sat, 12 Mar 2022 21:34:57 +0100 Message-ID: References: <871qz85bwh.fsf@ericabrahamsen.net> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="91pdWQa03fOKhwMA" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="4012"; mail-complaints-to="usenet@ciao.gmane.io" To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org Sat Mar 12 21:36:07 2022 Return-path: Envelope-to: geh-help-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 1nT8T8-0000qi-Kb for geh-help-gnu-emacs@m.gmane-mx.org; Sat, 12 Mar 2022 21:36:06 +0100 Original-Received: from localhost ([::1]:56080 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nT8T7-0001o3-C1 for geh-help-gnu-emacs@m.gmane-mx.org; Sat, 12 Mar 2022 15:36:05 -0500 Original-Received: from eggs.gnu.org ([209.51.188.92]:58852) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nT8S6-0001nv-Th for help-gnu-emacs@gnu.org; Sat, 12 Mar 2022 15:35:03 -0500 Original-Received: from mail.tuxteam.de ([5.199.139.25]:38900) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nT8S4-0004J8-Pt for help-gnu-emacs@gnu.org; Sat, 12 Mar 2022 15:35:02 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=tuxteam.de; s=mail; h=From:In-Reply-To:Content-Type:MIME-Version:References:Message-ID: Subject:To:Date:Sender:Reply-To:Cc:Content-Transfer-Encoding:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Id:List-Help:List-Unsubscribe:List-Subscribe: List-Post:List-Owner:List-Archive; bh=+zTVMkW4b48TkbZjjV1DMbwmHTiKnSdpG4LTSke3BgA=; b=byhm7mVsf4edzEwILgCCPdOUx8 vXmAHNJ8vlSq9zdZMbqPvnMtaRhGHUdEj6FA/rYjY2Mctbg8pcyyaRXlfq5xMx275oiD7P2yfPBK1 QqaF3nGyXSaRuMi/u6J0wt7VGjYKFj8vv0RBLoBeD8VFwEYzV6JtTxHpRAd3QXQyZHK+KWFFx1t2Z cInwZc7YPFqroowVQxBz42MK6OKh6SVhdaKhDWmlWxOg9lRwNny1beA4ezmwZtC0shEJizuofoB1C RVG4nEeFn2ZStHJr0c+XMyMyh9cBeHGe77yUaNSKtxBR1ldTndZ51mYyMuq6fHxd8d6r+DyR3iKfM c6TxEN+A==; Original-Received: from tomas by mail.tuxteam.de with local (Exim 4.94.2) (envelope-from ) id 1nT8S1-0000CJ-KF for help-gnu-emacs@gnu.org; Sat, 12 Mar 2022 21:34:57 +0100 Content-Disposition: inline In-Reply-To: Received-SPF: pass client-ip=5.199.139.25; envelope-from=tomas@tuxteam.de; helo=mail.tuxteam.de X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: "help-gnu-emacs" Xref: news.gmane.io gmane.emacs.help:136502 Archived-At: --91pdWQa03fOKhwMA Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Sat, Mar 12, 2022 at 03:56:24PM -0300, Eduardo Ochs wrote: > On Sat, 12 Mar 2022 at 10:33, Stefan Monnier w= rote: > > > > Eduardo Ochs [2022-03-12 03:08:04] wrote: > > > On Sat, 12 Mar 2022 at 01:56, Stefan Monnier via Users list for the > > > GNU Emacs text editor wrote: > > >> That's right. > > >> Nowadays, *all* files with a `.el` extension should have > > >> `-*- lexical-binding:t -*-` somewhere on their first line. > > > > > > Or a `-*- lexical-binding:nil -*-`... > > > > The only justification I've seen for that so far is for tests that check > > whether something still works with the old dialect of ELisp (i.e. for > > files which can simply be deleted the day this old dialect is not > > supported any more). >=20 > Well, SOME people like dynamic binding very much and they have code > that would be VERY hard to rewrite in lexical binding... >=20 > https://lists.gnu.org/archive/html/help-gnu-emacs/2021-08/msg00345.html This reference is actually an argument *for* lexical binding as a default, which is what -*- lexical-binding:t -*- does. > https://debbugs.gnu.org/cgi/bugreport.cgi?bug=3D30078#86 This one doesn't argue against -*- lexical-binding:t -*- but only for keeping the possibility of having single dynamically bound variables (and if you actually read your first reference carefully, Drew favours "lexical by default, dynamic as an exception", so definitely not -*- lexical-binding:nil -*-, as you propose. > https://www.gnu.org/software/emacs/emacs-paper.html#SEC18 "This paper was written by Richard Stallman in 1981 and delivered in the ACM Conference on Text Processing." Perl was born 1988 (seven years later) with dynamic binding (after all, one of its spiritual parents was the UNIX shell, which also has dynamic binding). In the meantime it is firmly in the lexical camp (it keeps dynamic variables, they are useful, but they are *by far* the exception). Things have changed since then... a lot. You can do what the above reference does with closures, which take... lexical binding. Besides, the closure way is clearer and safer. You might argue that dynamic binding is useful in some *single* exceptional cases (this is the position Common Lisp or Perl take; also the Schemes). But as a default for a whole file... no, you don't really want that. You want to put -*- lexical-binding:nil -*- at the top of a file if you have inherited it and haven't come around to check whether it will break under the (not anymore so) new discipline. Note that most well-writen code won't mind which kind of binding you use. Cheers --=20 t --91pdWQa03fOKhwMA Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iF0EABECAB0WIQRp53liolZD6iXhAoIFyCz1etHaRgUCYi0D6wAKCRAFyCz1etHa Ric7AJ9pTGE9Hyzg8uRalgtBA9c3asm5BgCeNhmhk/wVztbjfAcr3lM3th1nofM= =LJQC -----END PGP SIGNATURE----- --91pdWQa03fOKhwMA--