[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Lexical binding
From: |
David Kastrup |
Subject: |
Re: Lexical binding |
Date: |
Tue, 05 Apr 2011 00:03:41 +0200 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/24.0.50 (gnu/linux) |
Stefan Monnier <address@hidden> writes:
>>> Check the `dolist' macro, it has a FIXME for that.
>> OK, fair enough. Sorry for the noise.
>> Is this one also documented (or has a logical explanation that I'm
>> again missing)?
>
> No, it's not documented tho it's the same underlying problem:
>
>> ;; test.el -*- lexical-binding: t -*-
>> (condition-case test
>> (ignore)
>> (quit test)
>> (error test))
>> ;; end
>
>> No error. Now, if you remove `test' in either handler:
>
> Right. Internally, the condition-case above is turned into
>
> (condition-case :fun-body
> (lambda () (ignore))
> (quit (lambda (test) test))
> (error (lambda (test) test)))
>
> I.e. the underlying problem (shared with dolist and some pcase
> situations as well) is that one binding occurrence of a variable (above,
> `test') is turned into 2 or more, so you can get warnings about an
> unused variable because some of the its binders aren't used, but since
> it really corresponds to a single binder in the source code the
> programmer can't really fix it, hence the warning is an annoyance.
>
> I'm not sure yet how best to solve the issue.
Go through a stage
(condition-case :fun-body (lambda () ignore)
(multi-lambda (x) (quit (x test) test) (error (x test) test)))
or something similar where the byte compiler does the "unused variable"
check (or a setup for it) during the multi-lambda expansion stage. What
kind of form is exactly needed here in order to cater for all such
situations will require careful thinking.
--
David Kastrup
- Re: cedet-bzr build failure, (continued)
- Re: Lexical binding, Eli Zaretskii, 2011/04/01
- Re: Lexical binding, Juanma Barranquero, 2011/04/01
- Re: Lexical binding, Juanma Barranquero, 2011/04/01
- Re: Lexical binding, Stefan Monnier, 2011/04/02
- Re: Lexical binding, Juanma Barranquero, 2011/04/04
- Re: Lexical binding, Stefan Monnier, 2011/04/04
- Re: Lexical binding, Juanma Barranquero, 2011/04/04
- Re: Lexical binding,
David Kastrup <=
- Re: Lexical binding, Stefan Monnier, 2011/04/04
Re: Lexical binding, Stefan Monnier, 2011/04/02
- Re: Lexical binding, Juanma Barranquero, 2011/04/02
- Re: Lexical binding, Juanma Barranquero, 2011/04/02
- Re: Lexical binding, Christian Ohler, 2011/04/03
- Re: Lexical binding, Juanma Barranquero, 2011/04/03
- Re: Lexical binding, Christian Ohler, 2011/04/03
- Re: Lexical binding, Juanma Barranquero, 2011/04/03
- Re: Lexical binding, Stefan Monnier, 2011/04/04