From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: storm@cua.dk (Kim F. Storm) Newsgroups: gmane.emacs.devel Subject: Re: Building Emacs overflowed pure space Date: Thu, 20 Jul 2006 11:34:31 +0200 Message-ID: References: <7dbe73ed0607180138x35e9d9bft3e42f20cb369795c@mail.gmail.com> <200607181929.k6IJTZN9028639@jane.dms.auburn.edu> NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: sea.gmane.org 1153388210 6677 80.91.229.2 (20 Jul 2006 09:36:50 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Thu, 20 Jul 2006 09:36:50 +0000 (UTC) Cc: mathias.dahl@gmail.com, teirllm@dms.auburn.edu, ralphm@members.fsf.org, YAMAMOTO Mitsuharu , emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Thu Jul 20 11:36:45 2006 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by ciao.gmane.org with esmtp (Exim 4.43) id 1G3UxQ-0007R1-Be for ged-emacs-devel@m.gmane.org; Thu, 20 Jul 2006 11:36:36 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1G3UxP-0003HE-TY for ged-emacs-devel@m.gmane.org; Thu, 20 Jul 2006 05:36:35 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1G3UxF-0003GZ-35 for emacs-devel@gnu.org; Thu, 20 Jul 2006 05:36:25 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1G3UxD-0003FE-AO for emacs-devel@gnu.org; Thu, 20 Jul 2006 05:36:24 -0400 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1G3UxD-0003F9-4j for emacs-devel@gnu.org; Thu, 20 Jul 2006 05:36:23 -0400 Original-Received: from [195.41.46.237] (helo=pfepc.post.tele.dk) by monty-python.gnu.org with esmtp (Exim 4.52) id 1G3UxK-0008CT-Lc; Thu, 20 Jul 2006 05:36:30 -0400 Original-Received: from kfs-l.imdomain.dk.cua.dk (unknown [80.165.4.124]) by pfepc.post.tele.dk (Postfix) with SMTP id 830418A0040; Thu, 20 Jul 2006 11:36:13 +0200 (CEST) Original-To: rms@gnu.org In-Reply-To: (Richard Stallman's message of "Wed, 19 Jul 2006 17:15:53 -0400") User-Agent: Gnus/5.11 (Gnus v5.11) Emacs/22.0.50 (gnu/linux) 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:57371 Archived-At: Richard Stallman writes: > I see no good reason why each expansion of `dolist' should use a > different symbol. Maybe we can arrange to use one symbol over and > over again. Does this work? I'm getting confused now (the summer heat here is draining). Why is make-symbol used in dolist at all? The benefit seems infinitesimal to me, and in particular if you now suggest that we should intern another variable just to hold the uninterned symbol. Current version: (defmacro dolist (spec &rest body) "Loop over a list. Evaluate BODY with VAR bound to each car from LIST, in turn. Then evaluate RESULT to get return value, default nil. \(fn (VAR LIST [RESULT]) BODY...)" (declare (indent 1) (debug ((symbolp form &optional form) body))) (let ((temp (make-symbol "--dolist-temp--"))) `(let ((,temp ,(nth 1 spec)) ,(car spec)) (while ,temp (setq ,(car spec) (car ,temp)) (setq ,temp (cdr ,temp)) ,@body) ,@(if (cdr (cdr spec)) `((setq ,(car spec) nil) ,@(cdr (cdr spec))))))) Why isn't the following version just as good? (defmacro dolist (spec &rest body) "Loop over a list. Evaluate BODY with VAR bound to each car from LIST, in turn. Then evaluate RESULT to get return value, default nil. \(fn (VAR LIST [RESULT]) BODY...)" (declare (indent 1) (debug ((symbolp form &optional form) body))) `(let ((--dolist-temp-- ,(nth 1 spec)) ,(car spec)) (while --dolist-temp-- (setq ,(car spec) (car --dolist-temp--)) (setq --dolist-temp-- (cdr --dolist-temp--)) ,@body) ,@(if (cdr (cdr spec)) `((setq ,(car spec) nil) ,@(cdr (cdr spec)))))) > > > > (defvar dolist-temp-var nil) > > (defmacro dolist (spec &rest body) > "Loop over a list. > Evaluate BODY with VAR bound to each car from LIST, in turn. > Then evaluate RESULT to get return value, default nil. > > \(fn (VAR LIST [RESULT]) BODY...)" > (declare (indent 1) (debug ((symbolp form &optional form) body))) > (unless dolist-temp-var > (setq dolist-temp-var (make-symbol "--dolist-temp--"))) > (let ((temp dolist-temp-var)) > `(let ((,temp ,(nth 1 spec)) > ,(car spec)) > (while ,temp > (setq ,(car spec) (car ,temp)) > (setq ,temp (cdr ,temp)) > ,@body) > ,@(if (cdr (cdr spec)) > `((setq ,(car spec) nil) ,@(cdr (cdr spec))))))) -- Kim F. Storm http://www.cua.dk