[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: How to tame compiler?
From: |
Stefan Monnier |
Subject: |
Re: How to tame compiler? |
Date: |
Fri, 30 Apr 2021 18:20:26 -0400 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux) |
Emanuel Berg via Users list for the GNU Emacs text editor [2021-05-01 00:06:30]
wrote:
> Jorge P. de Morais Neto wrote:
>>>> Is there a way to avoid these warnings?
>>> Yes: don't abuse `eval` ;-)
> Stefan Monnier who wrote that last part, or anyone else for
> that matter, what is the rule of thumb when to and when not to
> use `eval'?
Use it only when you have to, otherwise don't use it.
> (let ((cmd (cl-find-if (lambda (c)
> (and (eq (car c) #'wrap-search)
> (not (string= (cl-caddr c) "")) ))
> command-history) ))
> (if cmd
> (if (= new-options 1)
> (eval cmd)
Here, as in your other example, you have to use `eval`, because
`command-history` was defined to contain a list of ELisp expressions and
those can't be used other than via `eval`.
So I'll grant you a pass for this time.
If you were in a position to control the format of history variable,
then you wouldn't have to use `eval` here, OTOH: you could define that
variable to hold a list of *functions* and you'd just use `funcall`
instead of `eval`.
Stefan
- rcd-template-eval, much is in Org mode, (continued)
- rcd-template-eval, much is in Org mode, Jean Louis, 2021/04/30
- Re: rcd-template-eval, much is in Org mode, Tassilo Horn, 2021/04/30
- Re: rcd-template-eval, much is in Org mode, Emanuel Berg, 2021/04/30
- Org mode rant, Jean Louis, 2021/04/30
- Re: Org mode rant, Emanuel Berg, 2021/04/30
- eval myths - Re: How to tame compiler?, Jean Louis, 2021/04/30
- Re: eval myths - Re: How to tame compiler?, Emanuel Berg, 2021/04/30
- Re: eval myths - Re: How to tame compiler?, Jean Louis, 2021/04/30
- Re: eval myths - Re: How to tame compiler?, Emanuel Berg, 2021/04/30
- Re: How to tame compiler?, Emanuel Berg, 2021/04/30
- Re: How to tame compiler?,
Stefan Monnier <=
- Re: How to tame compiler?, Emanuel Berg, 2021/04/30
- Re: How to tame compiler?, Stefan Monnier, 2021/04/30
- Re: How to tame compiler?, Emanuel Berg, 2021/04/30
Re: How to tame compiler?, Michael Heerdegen, 2021/04/30