[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: How to avoid compiler warning `unused lexical variable' for `dolist'
From: |
tomas |
Subject: |
Re: How to avoid compiler warning `unused lexical variable' for `dolist' or `dotimes'? |
Date: |
Fri, 8 Jan 2021 12:07:43 +0100 |
User-agent: |
Mutt/1.5.21 (2010-09-15) |
On Fri, Jan 08, 2021 at 09:28:58AM +0100, Emanuel Berg via Users list for the
GNU Emacs text editor wrote:
[...]
> Question 2: Why is this problem so difficult to solve at its
> source? What's with these functions that enables them to
> cloak, if you will, so the byte compiler cannot se what the
> human eye can see instantly, looking at the same material?
I think Stefan explained that pretty well in this thread:
dotimes is implemented as a macro (the alternative would
be to special-case it) which introduces a let-binding to
the counting index... which is used in the result part,
unless it's not used, which then causes the byte compiler
to issue the warning.
Fixing that would take
(a) special-casing dotimes somehow. For maintaniability
reasons probably out of the question
(b) making the macro expander for dotimes smarter, to
skip introducing the let-binding. I'm not good enough
at macrology to even fathom what that means. Possibly
we end up with a macro three times as complex for very
little gain
(c) (that seems Stefan's favourite, and I tend to trust
him blindly in those things) discourage the three
argument use of dotimes, since it's not that idiomatic
in Elisp anyway (those idioms are more Common Lisp-y).
Makes more sense now?
Cheers
- t
signature.asc
Description: Digital signature
- Re: How to avoid compiler warning `unused lexical variable' for `dolist' or `dotimes'?, (continued)
- Re: How to avoid compiler warning `unused lexical variable' for `dolist' or `dotimes'?, Emanuel Berg, 2021/01/08
- Re: How to avoid compiler warning `unused lexical variable' for `dolist' or `dotimes'?, Stefan Monnier, 2021/01/08
- Re: How to avoid compiler warning `unused lexical variable' for `dolist' or `dotimes'?, Tomas Hlavaty, 2021/01/09
- Re: How to avoid compiler warning `unused lexical variable' for `dolist' or `dotimes'?, Stefan Monnier, 2021/01/09
- Re: How to avoid compiler warning `unused lexical variable' for `dolist' or `dotimes'?, Tomas Hlavaty, 2021/01/10
- Re: How to avoid compiler warning `unused lexical variable' for `dolist' or `dotimes'?, Stefan Monnier, 2021/01/10
- Re: How to avoid compiler warning `unused lexical variable' for `dolist' or `dotimes'?, Tomas Hlavaty, 2021/01/11
- Re: How to avoid compiler warning `unused lexical variable' for `dolist' or `dotimes'?, Jean Louis, 2021/01/08
- Re: How to avoid compiler warning `unused lexical variable' for `dolist' or `dotimes'?, Stefan Monnier, 2021/01/08
- Re: How to avoid compiler warning `unused lexical variable' for `dolist' or `dotimes'?, Emanuel Berg, 2021/01/08
- Re: How to avoid compiler warning `unused lexical variable' for `dolist' or `dotimes'?,
tomas <=
- Re: How to avoid compiler warning `unused lexical variable' for `dolist' or `dotimes'?, Emanuel Berg, 2021/01/08
- Re: How to avoid compiler warning `unused lexical variable' for `dolist' or `dotimes'?, tomas, 2021/01/08
- Re: How to avoid compiler warning `unused lexical variable' for `dolist' or `dotimes'?, Philipp Stephani, 2021/01/08
- Re: How to avoid compiler warning `unused lexical variable' for `dolist' or `dotimes'?, Emanuel Berg, 2021/01/08
- Re: How to avoid compiler warning `unused lexical variable' for `dolist' or `dotimes'?, Emanuel Berg, 2021/01/08
- Re: How to avoid compiler warning `unused lexical variable' for `dolist' or `dotimes'?, Philipp Stephani, 2021/01/08
- Re: How to avoid compiler warning `unused lexical variable' for `dolist' or `dotimes'?, Emanuel Berg, 2021/01/08
- Re: How to avoid compiler warning `unused lexical variable' for `dolist' or `dotimes'?, tomas, 2021/01/08
- Re: How to avoid compiler warning `unused lexical variable' for `dolist' or `dotimes'?, Jean Louis, 2021/01/09
- Re: How to avoid compiler warning `unused lexical variable' for `dolist' or `dotimes'?, Leo Butler, 2021/01/09