emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: PATCH: Explicitly show how let works on global-variables


From: Phil Sainty
Subject: Re: PATCH: Explicitly show how let works on global-variables
Date: Wed, 05 Oct 2022 00:56:11 +1300
User-agent: Orcon Webmail

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."




reply via email to

[Prev in Thread] Current Thread [Next in Thread]