From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: pjb@informatimago.com (Pascal J. Bourguignon) Newsgroups: gmane.emacs.help Subject: Re: Replacement for Common Lisp's GENSYM in Emacs Lisp Date: Thu, 11 Mar 2010 23:48:12 +0100 Organization: Informatimago Message-ID: <87hbomtqz7.fsf@galatea.lan.informatimago.com> References: <87r5nx1nqo.fsf@mithlond.arda> <20100307054835.GB13731@tomas> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: dough.gmane.org 1272992070 13039 80.91.229.12 (4 May 2010 16:54:30 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Tue, 4 May 2010 16:54:30 +0000 (UTC) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Tue May 04 18:54:29 2010 connect(): No such file or directory Return-path: Envelope-to: geh-help-gnu-emacs@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 1O9LO9-0005gI-5S for geh-help-gnu-emacs@m.gmane.org; Tue, 04 May 2010 18:54:29 +0200 Original-Received: from localhost ([127.0.0.1]:40393 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1O9LO8-0002MB-G6 for geh-help-gnu-emacs@m.gmane.org; Tue, 04 May 2010 12:54:28 -0400 Original-Path: usenet.stanford.edu!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail Original-Newsgroups: gnu.emacs.help Original-Lines: 32 Original-X-Trace: individual.net RZFfWVqVSSSISKY6ovmkYgFBBJYM1EN8tHhOWgxTqJwVoU2n+K Cancel-Lock: sha1:YmNmMmM0Y2MwYWE0NGE5NWY2NmZjMWU0NjUwYTQ1OTQxNGU0Njc1NQ== sha1:l4fBOsBBvuJA2n2HmOANSxKv5ek= Face: iVBORw0KGgoAAAANSUhEUgAAADAAAAAwAQMAAABtzGvEAAAABlBMVEUAAAD///+l2Z/dAAAA oElEQVR4nK3OsRHCMAwF0O8YQufUNIQRGIAja9CxSA55AxZgFO4coMgYrEDDQZWPIlNAjwq9 033pbOBPtbXuB6PKNBn5gZkhGa86Z4x2wE67O+06WxGD/HCOGR0deY3f9Ijwwt7rNGNf6Oac l/GuZTF1wFGKiYYHKSFAkjIo1b6sCYS1sVmFhhhahKQssRjRT90ITWUk6vvK3RsPGs+M1RuR mV+hO/VvFAAAAABJRU5ErkJggg== X-Accept-Language: fr, es, en X-Disabled: X-No-Archive: no User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.1 (darwin) Original-Xref: usenet.stanford.edu gnu.emacs.help:177433 X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:72953 Archived-At: Teemu Likonen writes: > * 2010-03-07 06:48 (+0100), tomas@tuxteam.de wrote: > >> On Sat, Mar 06, 2010 at 05:19:43PM +0200, Teemu Likonen wrote: >>> In Common Lisp GENSYM function generates unique symbol names. It >>> seems that Emacs Lisp does not have similar function (unless with CL >>> extension). In plain Emacs Lisp code and macros, what would you >>> suggest as a replacement for GENSYM? Just some very unlikely names? >> >> It seems `make-symbol' is what you are looking for. It generates an >> uninterned symbol. Cf. Emacs Lisp manual "13.6.3 Local Variables in >> Macro Expansions" to find an usage example. > > That's right. My question was rather stupid, or at least asked too > hastily. It was in my mental patterns that I need GENSYM to create > symbols for macros. So I immediately thought I need to write a GENSYM > replacement for Emacs Lisp. But as you and David pointed out, the point > wasn't really unique print names but uninterned symbols. So make-symbol > is often sufficient. Thanks. Of course, (even in Common Lisp) macros could always use make-symbol. If we use (gensym), or even better, (gensym "varname"), it's to be able to read the expansion of macros. It's a debugging device. But we could also (setq print-circle t) and use (make-symbol "varname"); the #=/## notation will allow us to distinguish the different symbols generated. -- __Pascal Bourguignon__