From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Phil Sainty Newsgroups: gmane.emacs.devel Subject: Re: PATCH: Explicitly show how let works on global-variables Date: Wed, 05 Oct 2022 00:56:11 +1300 Message-ID: References: Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII; format=flowed Content-Transfer-Encoding: 7bit Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="34786"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Orcon Webmail Cc: emacs-devel@gnu.org To: tomas@tuxteam.de Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Tue Oct 04 13:58:15 2022 Return-path: Envelope-to: ged-emacs-devel@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 1ofgYx-0008nG-Oz for ged-emacs-devel@m.gmane-mx.org; Tue, 04 Oct 2022 13:58:15 +0200 Original-Received: from localhost ([::1]:53828 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ofgYw-0001oc-GI for ged-emacs-devel@m.gmane-mx.org; Tue, 04 Oct 2022 07:58:14 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:54308) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ofgX5-0000LW-Nf for emacs-devel@gnu.org; Tue, 04 Oct 2022 07:56:21 -0400 Original-Received: from smtp-2.orcon.net.nz ([60.234.4.43]:42663) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ofgX3-0004IS-3y for emacs-devel@gnu.org; Tue, 04 Oct 2022 07:56:18 -0400 Original-Received: from [10.253.37.70] (port=54730 helo=webmail.orcon.net.nz) by smtp-2.orcon.net.nz with esmtpa (Exim 4.90_1) (envelope-from ) id 1ofgWy-0005kw-2A; Wed, 05 Oct 2022 00:56:12 +1300 Original-Received: from ip-116-251-140-135.kinect.net.nz ([116.251.140.135]) via [10.253.37.253] by webmail.orcon.net.nz with HTTP (HTTP/1.1 POST); Wed, 05 Oct 2022 00:56:11 +1300 In-Reply-To: X-Sender: psainty@orcon.net.nz X-GeoIP: -- Received-SPF: pass client-ip=60.234.4.43; envelope-from=psainty@orcon.net.nz; helo=smtp-2.orcon.net.nz X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.29 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-mx.org@gnu.org Original-Sender: "Emacs-devel" Xref: news.gmane.io gmane.emacs.devel:296875 Archived-At: On 2022-10-04 20:59, tomas@tuxteam.de wrote: > I think this is technically wrong and potentially confusing. > > I'd tend to say that a new binding is created which shadows the > global binding. The `system-time-locale' in your let-bound scope > is a different variable from the global one, although it has the > same name. > > More importantly, nothing gets "restored": it's just the compiler > which sees a different variable depending on scope. This is even > "more true" (I know, I know) with lexical variables. I think this is technically wrong and potentially confusing :) (info "(elisp)Dynamic Binding") explains it pretty clearly: "Dynamic binding is implemented in Emacs Lisp in a simple way. Each symbol has a value cell, which specifies its current dynamic value (or absence of value). *Note Symbol Components::. When a symbol is given a dynamic local binding, Emacs records the contents of the value cell (or absence thereof) in a stack, and stores the new local value in the value cell. When the binding construct finishes executing, Emacs pops the old value off the stack, and puts it in the value cell."