bug-gnu-emacs
[Top][All Lists]
Advanced

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

bug#66756: 30.0.50; [PATCH] Improve discussion of 'let' in Elisp Introdu


From: Richard Stallman
Subject: bug#66756: 30.0.50; [PATCH] Improve discussion of 'let' in Elisp Introduction manual
Date: Wed, 22 Nov 2023 21:57:50 -0500

[[[ To any NSA and FBI agents reading my email: please consider    ]]]
[[[ whether defending the US Constitution against all enemies,     ]]]
[[[ foreign or domestic, requires you to follow Snowden's example. ]]]

Your work is good.

After this,

  > +;;; -*- lexical-binding: t -*-
  > +
  > +(setq x 1)
  > +
  > +(defun getx ()
  > +  x)
  > +
  > +(let ((x 2))
  > +  (getx))
  > +     @result{} 1
  > +@end example

it could be good to add the following:

+(setq x 3)
+
+(let ((x 2))
+  (getx))
+     @result{} 3
+
+(setq x '(foo))
+
+(let ((x 2))
+  (getx))
+     @result{} (foo)
+@end example

to show that `getx' accesses the current value of the global binding,
not the value that the global binding had when getx was defined.

Adding this to the lexical binding example

+(setq x 3)
+
+(let ((x 2))
+  (getx))
+     @result{} 2
+
+(setq x '(foo))
+
+(let ((x 2))
+  (getx))
+     @result{} 2

could also help, by showing that changes in the global binding's value
are irrelevant for references to x where that binding is shadowed.

Or perhaps this pair of examples should be presented as a separate
point following the other one.
-- 
Dr Richard Stallman (https://stallman.org)
Chief GNUisance of the GNU Project (https://gnu.org)
Founder, Free Software Foundation (https://fsf.org)
Internet Hall-of-Famer (https://internethalloffame.org)







reply via email to

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