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

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

Re: Appending to a list


From: Emanuel Berg
Subject: Re: Appending to a list
Date: Mon, 14 Dec 2020 07:36:18 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux)

steve-humphreys wrote:

> Do you mean that by commenting the defvars and using "setq",
> the compiler will complain because no variables were defined
> by bird-list*.

Yes, removing or commenting out the defvars and then using
`setq' that will happen.

> defvar can only be assigned if they have not been set and
> have a documentation string.

Use `defvar' before setq. The init value is often a source of
confusion... but use it by all means if it fancies you.
The docstring is also optional. Use it in packages. In your own
code, obviously you do whatever you want.

Just

  (defvar pi)
  (setq pi 3.1415)

is OK :)

> But when do you decide betweenh setq and defvar?

Use defvar first, then setq. But avoid it all if you can by
using defuns and `let'/`let*'.

> Is the problem with the compiler occurring because of
> cl-pushnew?

The byte-compiler is OK with `cl-pushnew' because of the
previous (require 'cl-lib) line.

-- 
underground experts united
http://user.it.uu.se/~embe8573
https://dataswamp.org/~incal




reply via email to

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