[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: unused local variables
From: |
Stefan Monnier |
Subject: |
Re: unused local variables |
Date: |
Fri, 30 Nov 2007 10:10:31 -0500 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/23.0.50 (gnu/linux) |
> Are you saying that in
> (defun test ()
> (if my-dynamic-var
> "correct"
> "erroneous"))
> (let ((my-dynamic-var t))
> (test))
> you would force my-dynamic-var to be `defvar'ed to avoid a warning in the let?
Yes. And that's good. E.g. if you want to compile this file with the
lexical-scoping version of Emacs that Miles has been working on, this
is indispensable.
BTW, in the above example, the byte-compiler already complains in the
`test' function, so it's not like it's going to make that big
a difference.
Also dynamic scoping is sufficiently odd and rarely used that it deserve
special mention in the code. It's pretty common to mark it with
a comment. And code is always better than a comment since it tends to
bitrot a bit less quickly.
Stefan
PS: Another "unused var" warning which we should add (I don't have it
in my lock hack yet, tho) is the one that notices when a `defvar'
declares a variable which is not used in the file.
- Re: unused local variables, (continued)
- Re: unused local variables, David Kastrup, 2007/11/30
- Re: unused local variables, Juanma Barranquero, 2007/11/30
- Re: unused local variables, David Kastrup, 2007/11/30
- Re: unused local variables, Juanma Barranquero, 2007/11/30
- Re: unused local variables, David Kastrup, 2007/11/30
- Re: unused local variables, Juanma Barranquero, 2007/11/30
- Re: unused local variables, 山本和彦, 2007/11/30
- Re: unused local variables, Juanma Barranquero, 2007/11/30
- Re: unused local variables, David Kastrup, 2007/11/30
- Re: unused local variables, Juanma Barranquero, 2007/11/30
- Re: unused local variables,
Stefan Monnier <=
- Re: unused local variables, Juanma Barranquero, 2007/11/30
- Re: unused local variables, Stefan Monnier, 2007/11/30
- Re: unused local variables, David Kastrup, 2007/11/30
- Re: unused local variables, tomas, 2007/11/30
- Re: unused local variables, Juanma Barranquero, 2007/11/30
- Re: unused local variables, Juanma Barranquero, 2007/11/30
- Re: unused local variables, Stefan Monnier, 2007/11/30
- Re: unused local variables, Juanma Barranquero, 2007/11/30
- Re: unused local variables, Stefan Monnier, 2007/11/30
Re: unused local variables, Stefan Monnier, 2007/11/29