From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Stefan Monnier Newsgroups: gmane.emacs.devel Subject: Re: Lexical binding Date: Mon, 04 Apr 2011 17:44:30 -0400 Message-ID: References: NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: dough.gmane.org 1301953526 23645 80.91.229.12 (4 Apr 2011 21:45:26 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Mon, 4 Apr 2011 21:45:26 +0000 (UTC) Cc: emacs-devel@gnu.org To: Juanma Barranquero Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Mon Apr 04 23:45:22 2011 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1Q6raI-0006hN-S9 for ged-emacs-devel@m.gmane.org; Mon, 04 Apr 2011 23:45:19 +0200 Original-Received: from localhost ([127.0.0.1]:53205 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Q6rZe-0002QG-Nr for ged-emacs-devel@m.gmane.org; Mon, 04 Apr 2011 17:44:38 -0400 Original-Received: from [140.186.70.92] (port=58949 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Q6rZa-0002Q9-6Z for emacs-devel@gnu.org; Mon, 04 Apr 2011 17:44:35 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Q6rZY-0004Vl-UQ for emacs-devel@gnu.org; Mon, 04 Apr 2011 17:44:34 -0400 Original-Received: from ironport2-out.teksavvy.com ([206.248.154.183]:2576 helo=ironport2-out.pppoe.ca) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Q6rZY-0004VZ-Rc for emacs-devel@gnu.org; Mon, 04 Apr 2011 17:44:32 -0400 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AvsEAEQ7mk1Ld/Y6/2dsb2JhbAClY3iIebokhWsElj8 X-IronPort-AV: E=Sophos;i="4.63,299,1299474000"; d="scan'208";a="103153240" Original-Received: from 75-119-246-58.dsl.teksavvy.com (HELO pastel.home) ([75.119.246.58]) by ironport2-out.pppoe.ca with ESMTP/TLS/ADH-AES256-SHA; 04 Apr 2011 17:44:31 -0400 Original-Received: by pastel.home (Postfix, from userid 20848) id D80DC58C5B; Mon, 4 Apr 2011 17:44:30 -0400 (EDT) In-Reply-To: (Juanma Barranquero's message of "Mon, 4 Apr 2011 18:04:34 +0200") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.50 (gnu/linux) X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 206.248.154.183 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:138149 Archived-At: >> 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. The main problem is that this warning is important to help convert programs from dynamic to lexical scoping, so it's an important tool and hence shouldn't be silenced too lightheartedly. Stefan