From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Harald Hanche-Olsen Newsgroups: gmane.emacs.devel Subject: Re: Why are there two dolist? Date: Tue, 11 Aug 2009 19:30:25 -0400 (EDT) Message-ID: <20090811.193025.204578572.hanche@math.ntnu.no> References: <87d472m0b0.fsf@catnip.gol.com> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Trace: ger.gmane.org 1250033460 29678 80.91.229.12 (11 Aug 2009 23:31:00 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Tue, 11 Aug 2009 23:31:00 +0000 (UTC) To: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Wed Aug 12 01:30:53 2009 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.50) id 1Mb0nt-0003B6-Hj for ged-emacs-devel@m.gmane.org; Wed, 12 Aug 2009 01:30:53 +0200 Original-Received: from localhost ([127.0.0.1]:48329 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Mb0nr-0005EM-RI for ged-emacs-devel@m.gmane.org; Tue, 11 Aug 2009 19:30:51 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1Mb0nl-0005EF-Cc for emacs-devel@gnu.org; Tue, 11 Aug 2009 19:30:45 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1Mb0nh-0005Do-QH for emacs-devel@gnu.org; Tue, 11 Aug 2009 19:30:45 -0400 Original-Received: from [199.232.76.173] (port=37145 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Mb0nh-0005Dl-KM for emacs-devel@gnu.org; Tue, 11 Aug 2009 19:30:41 -0400 Original-Received: from abel.math.ntnu.no ([129.241.15.50]:50472) by monty-python.gnu.org with smtp (Exim 4.60) (envelope-from ) id 1Mb0nh-0002WO-1c for emacs-devel@gnu.org; Tue, 11 Aug 2009 19:30:41 -0400 Original-Received: (qmail 10076 invoked from network); 11 Aug 2009 23:30:36 -0000 Original-Received: from gauss.math.ntnu.no (HELO localhost) (hanche@129.241.15.102) by abel.math.ntnu.no with ESMTPA; 11 Aug 2009 23:30:36 -0000 In-Reply-To: X-URL: http://www.math.ntnu.no/~hanche/ X-Mailer: Mew version 6.2.51 on Emacs 23.0.94 / Mule 6.0 (HANACHIRUSATO) X-detected-operating-system: by monty-python.gnu.org: Solaris 8 (1) 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:114107 Archived-At: + Lennart Borgman : > On Wed, Aug 12, 2009 at 12:51 AM, Miles Bader wrote: > > I haven't looked at the code (recently), but because elisp doesn't > > natively support lexical blocks, I suspect the cl-macs version either > > (1) adds unnecessary runtime overhead, or (2) drags in lots of big and > > crufty compile-time analysis code (cl.el has lots of this) to optimize > > away the block when not used. Actually, the cl-macs version looks pretty simple to me. > Maybe the CL version should go away instead? It creates a lexically > scoped block with a name nil. The explanation in (defmacro block ...) > does however not say what is lexically scoped so I have no clue. AFAICT, the only thing lexically scoped is the name of the block. In other words, (return-from NAME) will return from the innermost block named NAME that lexically contains the return-from form. I think this is pretty well explained in the block docstring? > (And I do not know if return-from mentioned there can work with a > nil name.) (return-from nil) is perfectly good CL, so it ought to work. > However if if means that one dolist version makes VAR lexically scoped > and the other does not, then the difference is big. But it doesn't mean that, as a simple experiment bears out. I think the only difference between the two is the block, and that will not affect any elisp code that is unaware of block and return-from. - Harald