[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: unused local variables
From: |
David Kastrup |
Subject: |
Re: unused local variables |
Date: |
Fri, 30 Nov 2007 10:59:57 +0100 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/23.0.50 (gnu/linux) |
"Juanma Barranquero" <address@hidden> writes:
> On Nov 30, 2007 10:27 AM, 山本和彦 Kazu Yamamoto <address@hidden> wrote:
>
>> XEmacs warns unused local variables as if they are statically bound.
>> Also XEmacs does not warns unused local variables if they are
>> also globally defined.
>
> 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?
I consider this quite reasonable. If my-dynamic-var is used for passing
information across function boundaries, it deserves being declared in
the same scope. There is one obvious exception:
(defun test ()
(let ((my-variable 3))
(funcall (lambda nil (1+ my-variable)))))
Namely, lambda functions using upvalues (well, conceptually as long as
we don't have closures). Those are byte-compiled as well and should not
complain.
--
David Kastrup, Kriemhildstr. 15, 44793 Bochum
- unused local variables, 山本和彦, 2007/11/29
- Re: unused local variables, Thien-Thi Nguyen, 2007/11/29
- Re: unused local variables, 山本和彦, 2007/11/29
- 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 <=
- 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, 2007/11/30