From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Stefan Monnier Newsgroups: gmane.emacs.bugs Subject: bug#8711: 24.0.50; binding _ to unused values with lexical-binding Date: Thu, 02 Jun 2011 09:45:09 -0300 Message-ID: References: NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: dough.gmane.org 1307019282 10462 80.91.229.12 (2 Jun 2011 12:54:42 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Thu, 2 Jun 2011 12:54:42 +0000 (UTC) Cc: 8711@debbugs.gnu.org, Helmut Eller To: Juanma Barranquero Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Thu Jun 02 14:54:37 2011 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([140.186.70.17]) by lo.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1QS7Q1-00086k-V7 for geb-bug-gnu-emacs@m.gmane.org; Thu, 02 Jun 2011 14:54:34 +0200 Original-Received: from localhost ([::1]:58050 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QS7Q0-0004GY-7w for geb-bug-gnu-emacs@m.gmane.org; Thu, 02 Jun 2011 08:54:32 -0400 Original-Received: from eggs.gnu.org ([140.186.70.92]:55336) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QS7Hq-0002Fc-3P for bug-gnu-emacs@gnu.org; Thu, 02 Jun 2011 08:46:07 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1QS7Ho-0006cG-2Z for bug-gnu-emacs@gnu.org; Thu, 02 Jun 2011 08:46:05 -0400 Original-Received: from debbugs.gnu.org ([140.186.70.43]:46520) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QS7Hn-0006c4-PE for bug-gnu-emacs@gnu.org; Thu, 02 Jun 2011 08:46:03 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.69) (envelope-from ) id 1QS7Hm-0004pQ-K5; Thu, 02 Jun 2011 08:46:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Stefan Monnier Original-Sender: debbugs-submit-bounces@debbugs.gnu.org Resent-To: owner@debbugs.gnu.org Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Thu, 02 Jun 2011 12:46:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 8711 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: Original-Received: via spool by 8711-submit@debbugs.gnu.org id=B8711.130701872118508 (code B ref 8711); Thu, 02 Jun 2011 12:46:02 +0000 Original-Received: (at 8711) by debbugs.gnu.org; 2 Jun 2011 12:45:21 +0000 Original-Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1QS7H7-0004oT-BJ for submit@debbugs.gnu.org; Thu, 02 Jun 2011 08:45:21 -0400 Original-Received: from fencepost.gnu.org ([140.186.70.10]) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1QS7H5-0004oG-45 for 8711@debbugs.gnu.org; Thu, 02 Jun 2011 08:45:20 -0400 Original-Received: from 121-249-126-200.fibertel.com.ar ([200.126.249.121]:17050 helo=ceviche.home) by fencepost.gnu.org with esmtpsa (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1QS7Gz-0004l8-Mc; Thu, 02 Jun 2011 08:45:13 -0400 Original-Received: by ceviche.home (Postfix, from userid 20848) id D891C660DD; Thu, 2 Jun 2011 09:45:09 -0300 (ART) In-Reply-To: (Juanma Barranquero's message of "Thu, 2 Jun 2011 13:17:56 +0200") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.50 (gnu/linux) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.11 Precedence: list Resent-Date: Thu, 02 Jun 2011 08:46:02 -0400 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 3) X-Received-From: 140.186.70.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.bugs:46886 Archived-At: > Apparently, the macroexpansion of `dolist' invokes RESULT as > (setq VAR nil) > RESULT > or, in the cl-macs `dolist', as > (let ((VAR nil)) > RESULT) > which I suppose has been doing for decades, but is still a bit > strange. That's how dolist/dotimes are defined in Common-Lisp, hence that's how it works in cl-macs. The subr versions also do it because when we introduced them, some people brought up the issue and it seemed there was no point in being incompatible. > The docstring for `dolist' does not say that VAR is set to > nil before computing RESULT. Indeed. > If computing RESULT needed the last VAR, the current code precludes it > (unless it requires VAR to be nil, of course ;-) Yes, I do find it very odd as well, but CLHS says clearly "At the time result-form is processed, var is bound to nil". > And, if computing RESULT requieres an outside VAR, the programmer is > going to be forced to use this anyway: > (let ((VAR 'myval)) > (dolist (VAR mylist) > ...) > (compute-my-result VAR)) ;; with the let-bound VAR, not the dolist-bound one Or she can just use different names rather than reusing the same variable name. > so setting it to nil in the (dolist (VAR LIST RESULT) ...) case does > not bring any clear benefit, even in the non-lexical case. Agreed. Stefan