diff options
| author | Jonas Bernoulli <jonas@bernoul.li> | 2021-01-10 15:01:06 +0100 |
|---|---|---|
| committer | David Bremner <david@tethera.net> | 2021-01-15 06:45:30 -0400 |
| commit | f47e3333b5478e43840e55710311aebdd441fc0e (patch) | |
| tree | f6edef3451d1b1122be87a44af75fdd4b49537fc /lib/string-map.c | |
| parent | 25a8873c68f9ef033d393efaf7f4c46a29f798f4 (diff) | |
emacs: avoid unnecessary let-bindings
To some extend this is a personal preference, but the preference is
strongly dependent on whether one is used to a language that makes it
necessary to use variables like this.
This makes it perfectly clear that we are first getting and then using
a "foo":
(use-foo (get-foo))
Sure this has to be read "inside out", but that's something one better
gets used to quickly when dealing with lisp. I don't understand why
one would want to write this instead:
(let ((the-foo (get-foo)))
(use-foo the-foo))
Both `get-foo' and `use-foo' are named in a way that make it very
clear that we are dealing with a "foo". Storing the value in an
additional variable `the-foo' does not make this any more clear.
On the contrary I makes the reader wonder why the author choose to
use a variable. Is the value used more than once? Is the value
being retrieved in one context and then used in another (e.g. when
the current buffer changes)?
Diffstat (limited to 'lib/string-map.c')
0 files changed, 0 insertions, 0 deletions
