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: Fri, 21 Jul 2006 10:36:22 +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 1153471135 29536 80.91.229.2 (21 Jul 2006 08:38:55 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Fri, 21 Jul 2006 08:38:55 +0000 (UTC) Cc: emacs-devel@gnu.org, teirllm@dms.auburn.edu, mituharu@math.s.chiba-u.ac.jp, ralphm@members.fsf.org, mathias.dahl@gmail.com Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Fri Jul 21 10:38:51 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 1G3qWz-0005Kp-0p for ged-emacs-devel@m.gmane.org; Fri, 21 Jul 2006 10:38:45 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1G3qWy-0002j9-BU for ged-emacs-devel@m.gmane.org; Fri, 21 Jul 2006 04:38:44 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1G3qWh-0002hr-EU for emacs-devel@gnu.org; Fri, 21 Jul 2006 04:38:27 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1G3qWg-0002he-BB for emacs-devel@gnu.org; Fri, 21 Jul 2006 04:38:27 -0400 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1G3qWg-0002hb-6T for emacs-devel@gnu.org; Fri, 21 Jul 2006 04:38:26 -0400 Original-Received: from [195.41.46.236] (helo=pfepb.post.tele.dk) by monty-python.gnu.org with esmtp (Exim 4.52) id 1G3qX0-0005gl-UX; Fri, 21 Jul 2006 04:38:47 -0400 Original-Received: from kfs-l.imdomain.dk.cua.dk (unknown [80.165.4.124]) by pfepb.post.tele.dk (Postfix) with SMTP id 18C47A50046; Fri, 21 Jul 2006 10:38:03 +0200 (CEST) Original-To: rms@gnu.org In-Reply-To: (Richard Stallman's message of "Thu, 20 Jul 2006 14:16:37 -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:57418 Archived-At: Richard Stallman writes: > 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-- > > The only flaw of this is that BODY can see the variable --dolist-temp--. > Practically speaking, it may not ever matter; users are unlikely to > use that variable by accident. However, it is cleaner to prevent that > by using an uninterned symbol, assuming we can get rid of the current > inefficiency that that causes. So what about using shorter symbol names than --dolist-temp-- --dotimes-temp--, --cl-dolist-temp-- etc. And for the "defconst-tmp-var" symbol used in byte-compile-defvar. E.g use "*" instead of the longer name. That'll save a few KBytes. But to follow your suggestion, why don't we just have _one_ generic uninterned "tmp" symbol for all such uses. E.g. (defconst uninterned-tmp (make-symbol "tmp") "Uninterned symbol for use in macros.") And then modify dolist (and friends) to: (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 uninterned-tmp)) `(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