From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Christian Ohler Newsgroups: gmane.emacs.devel Subject: Re: Lexical binding Date: Mon, 04 Apr 2011 09:32:27 +1000 Message-ID: <4D99038B.7060702@gnu.org> References: <4D98629F.9070506@gnu.org> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Trace: dough.gmane.org 1301884972 15290 80.91.229.12 (4 Apr 2011 02:42:52 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Mon, 4 Apr 2011 02:42:52 +0000 (UTC) Cc: Stefan Monnier , emacs-devel@gnu.org To: Juanma Barranquero Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Mon Apr 04 04:42:48 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 1Q6Zke-0004YE-23 for ged-emacs-devel@m.gmane.org; Mon, 04 Apr 2011 04:42:48 +0200 Original-Received: from localhost ([127.0.0.1]:59327 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Q6Zkd-0002wz-DR for ged-emacs-devel@m.gmane.org; Sun, 03 Apr 2011 22:42:47 -0400 Original-Received: from [140.186.70.92] (port=60002 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Q6Wmb-0002ts-Lq for emacs-devel@gnu.org; Sun, 03 Apr 2011 19:32:41 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Q6Wma-0001I0-Kg for emacs-devel@gnu.org; Sun, 03 Apr 2011 19:32:37 -0400 Original-Received: from fencepost.gnu.org ([140.186.70.10]:59833) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Q6Wma-0001Hw-GU for emacs-devel@gnu.org; Sun, 03 Apr 2011 19:32:36 -0400 Original-Received: from [113.197.106.249] (port=52415 helo=ohler-macbookpro-2.local) by fencepost.gnu.org with esmtpsa (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1Q6WmZ-0004hY-JI; Sun, 03 Apr 2011 19:32:36 -0400 In-Reply-To: X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 3) X-Received-From: 140.186.70.10 X-Mailman-Approved-At: Sun, 03 Apr 2011 22:42:40 -0400 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:138096 Archived-At: On 3/04/11 22:26, Juanma Barranquero wrote: > On Sun, Apr 3, 2011 at 14:05, Christian Ohler wrote: > >> In loop destructuring, you can use nil for fields that you want to ignore: >> >> (loop for (nil width . nil) in bs-attributes-list >> if (numberp width) sum width) > > Yes, but it is less informative. > >> If you want to keep the ignored fields named, you could do something like >> >> (loop for (name width . rest) in bs-attributes-list >> do (progn name rest) ; ignore >> if (numberp width) sum width) > > And this is just ugly. How about: (loop for (name width . rest) in bs-attributes-list do (ignore name rest) if (numberp width) sum width) > Anyway, the point is that (elisp)11.9.5.1 "Converting a package to use > lexical scoping" says: > > To silence byte-compiler warnings about unused variables, just use a > variable name that start with an underscore, which the byte-compiler > interpret as an indication that this is a variable known not to be used. > > but this exception is quite less useful if assignments produce the > "variable `_x' not left unused" warning. IIRC, Common Lisp distinguishes between (declare (ignore ...)) and (declare (ignorable ...)). The latter is useful for macros that introduce bindings that may or may not be used. This doesn't really help with `loop', though, since it shouldn't declare its bindings ignorable. I guess Emacs Lisp's new underscore syntax is the equivalent of (declare (ignore ...)), with no way to (declare (ignorable ...)). If this is the case, then I agree it's not quite expressive enough, and requires idioms like the above (with many macros, not just `loop'). Christian.