[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Understanding the "let" construct and the setting of variables
From: |
Emanuel Berg |
Subject: |
Re: Understanding the "let" construct and the setting of variables |
Date: |
Fri, 18 Dec 2020 21:46:38 +0100 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux) |
steve-humphreys wrote:
> This gets me to "defvar". I have read that "setq" does net
> actually make a variable. It is defvar that makes a variable
> available. When reading the "Intro to Emacs Lisp", the focus
> is on using "setq".
`setq' is enough, it does the real job alright, but the
byte-compiler will complain if there isn't a `defvar'
before it.
Also with defvar you can set a default value and add
a docstring. None of that is mandatory and the default value
can even be confusing IMO.
Just think of defvar as a way of telling Emacs and everyone
else, "I intend to use a variable with this name."
This is enough, and always do it (_at least_ do that, of
course by all means set the default and add a docstring if
that fancies you), but always and at least do this:
(defvar some-var)
(setq some-var some-value)
That's enough. You have what you need and the byte-compiler
doesn't complain.
--
underground experts united
http://user.it.uu.se/~embe8573
https://dataswamp.org/~incal
- Re: Understanding the "let" construct and the setting of variables, (continued)
- Re: Understanding the "let" construct and the setting of variables, Joost Kremers, 2020/12/17
- Re: Understanding the "let" construct and the setting of variables, steve-humphreys, 2020/12/17
- Re: Understanding the "let" construct and the setting of variables, Joost Kremers, 2020/12/17
- Re: Understanding the "let" construct and the setting of variables, Emanuel Berg, 2020/12/18
- Re: Understanding the "let" construct and the setting of variables,
Emanuel Berg <=
- Re: Understanding the "let" construct and the setting of variables, Jean Louis, 2020/12/18
- Re: Understanding the "let" construct and the setting of variables, tomas, 2020/12/18
- Re: Understanding the "let" construct and the setting of variables, Emanuel Berg, 2020/12/18
Re: Understanding the "let" construct and the setting of variables, steve-humphreys, 2020/12/16
- Re: Understanding the "let" construct and the setting of variables, Joost Kremers, 2020/12/17
- RE: Understanding the "let" construct and the setting of variables, Drew Adams, 2020/12/17
- Re: RE: Understanding the "let" construct and the setting of variables, steve-humphreys, 2020/12/17
- RE: RE: Understanding the "let" construct and the setting of variables, Drew Adams, 2020/12/17
- Re: Understanding the "let" construct and the setting of variables, Michael Heerdegen, 2020/12/17
- Re: Understanding the "let" construct and the setting of variables, tomas, 2020/12/18