From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: David Kastrup Newsgroups: gmane.emacs.devel Subject: Re: Lexical binding Date: Tue, 05 Apr 2011 00:03:41 +0200 Organization: Organization?!? Message-ID: <877hb91xoi.fsf@fencepost.gnu.org> References: NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: dough.gmane.org 1301954819 30574 80.91.229.12 (4 Apr 2011 22:06:59 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Mon, 4 Apr 2011 22:06:59 +0000 (UTC) To: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Tue Apr 05 00:06:55 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 1Q6rvC-0002ud-UD for ged-emacs-devel@m.gmane.org; Tue, 05 Apr 2011 00:06:55 +0200 Original-Received: from localhost ([127.0.0.1]:38347 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Q6rvC-00075T-8u for ged-emacs-devel@m.gmane.org; Mon, 04 Apr 2011 18:06:54 -0400 Original-Received: from [140.186.70.92] (port=51781 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Q6rsT-00064P-Sx for emacs-devel@gnu.org; Mon, 04 Apr 2011 18:04:07 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Q6rsR-0002S9-FG for emacs-devel@gnu.org; Mon, 04 Apr 2011 18:04:04 -0400 Original-Received: from lo.gmane.org ([80.91.229.12]:49151) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Q6rsR-0002RB-3o for emacs-devel@gnu.org; Mon, 04 Apr 2011 18:04:03 -0400 Original-Received: from list by lo.gmane.org with local (Exim 4.69) (envelope-from ) id 1Q6rsO-00019v-FW for emacs-devel@gnu.org; Tue, 05 Apr 2011 00:04:00 +0200 Original-Received: from p508eda19.dip.t-dialin.net ([80.142.218.25]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Tue, 05 Apr 2011 00:04:00 +0200 Original-Received: from dak by p508eda19.dip.t-dialin.net with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Tue, 05 Apr 2011 00:04:00 +0200 X-Injected-Via-Gmane: http://gmane.org/ Original-Lines: 46 Original-X-Complaints-To: usenet@dough.gmane.org X-Gmane-NNTP-Posting-Host: p508eda19.dip.t-dialin.net X-Face: 2FEFf>]>q>2iw=B6, xrUubRI>pR&Ml9=ao@P@i)L:\urd*t9M~y1^:+Y]'C0~{mAl`oQuAl \!3KEIp?*w`|bL5qr,H)LFO6Q=qx~iH4DN; i"; /yuIsqbLLCh/!U#X[S~(5eZ41to5f%E@'ELIi$t^ Vc\LWP@J5p^rst0+('>Er0=^1{]M9!p?&:\z]|;&=NP3AhB!B_bi^]Pfkw User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.50 (gnu/linux) Cancel-Lock: sha1:/aNJeY/p6nhohDYlpWtusZEeviY= X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 3) X-Received-From: 80.91.229.12 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:138157 Archived-At: Stefan Monnier 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