From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Joe Corneli Newsgroups: gmane.emacs.help Subject: Re: comparing symbols coming from gensym? Date: Wed, 24 Aug 2005 10:57:58 -0500 Message-ID: References: NNTP-Posting-Host: main.gmane.org X-Trace: sea.gmane.org 1124900262 26070 80.91.229.2 (24 Aug 2005 16:17:42 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Wed, 24 Aug 2005 16:17:42 +0000 (UTC) Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Wed Aug 24 18:17:34 2005 Return-path: Original-Received: from lists.gnu.org ([199.232.76.165]) by ciao.gmane.org with esmtp (Exim 4.43) id 1E7xsE-000699-6s for geh-help-gnu-emacs@m.gmane.org; Wed, 24 Aug 2005 18:13:14 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1E7xw3-0003GW-Mq for geh-help-gnu-emacs@m.gmane.org; Wed, 24 Aug 2005 12:17:07 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1E7xqE-0001Wa-GN for help-gnu-emacs@gnu.org; Wed, 24 Aug 2005 12:11:06 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1E7xq9-0001Vg-Oc for help-gnu-emacs@gnu.org; Wed, 24 Aug 2005 12:11:03 -0400 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1E7xq9-0001Is-Ii for help-gnu-emacs@gnu.org; Wed, 24 Aug 2005 12:11:01 -0400 Original-Received: from [146.6.139.124] (helo=dell3.ma.utexas.edu) by monty-python.gnu.org with esmtp (Exim 4.34) id 1E7xej-0003s7-4a for help-gnu-emacs@gnu.org; Wed, 24 Aug 2005 11:59:13 -0400 Original-Received: from lab1.ma.utexas.edu (lab1.ma.utexas.edu [128.83.133.39]) by dell3.ma.utexas.edu (8.11.0.Beta3/8.10.2) with ESMTP id j7OFvwY07695; Wed, 24 Aug 2005 10:57:58 -0500 Original-Received: from jcorneli by lab1.ma.utexas.edu with local (Exim 3.36 #1 (Debian)) id 1E7xdW-00040E-00; Wed, 24 Aug 2005 10:57:58 -0500 Original-To: help-gnu-emacs@gnu.org In-reply-to: (message from Alan Mackenzie on Wed, 24 Aug 2005 08:24:52 +0000) 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:28957 Archived-At: When you do (equal a 'G2007), this _creates_ a full-bloodied industrial-strength NEW _interned_ symbol G2007, since there wasn't already such a symbol in the obarray. This is distinct from your gensymmed one. That is, in fact, the whole point of gensym - to create a symbol distinct from any other symbol which ever has been or ever will be. You asked for it, you got it! If you want to actually _use_ it, you'll need something like (symbol-value a) (setq a (gensym)) ;=> G2016 this morning (symbol-name a) ;=> "G2016" (symbol-value a) ;=> `void-variable' error So I guess `symbol-name' is the thing to use. Incidentally, (symbol-value 'G2016) also gives a `void-variable' error. The moral of the story here is that I shouldn't be using `gensym' but rather something "gensym-like", better tailored to the situation I'm working in. Just to pick up the original thread briefly, the fact that I was using `equal' and not `eq' is maybe an argument for the comparison to return `t' even though the two variables are distinct and stored in different places; remember, it says ,---- | Return t if two Lisp objects have similar structure and contents. | They must have the same data type. `---- They have no contents (as evidenced above) and appear to be internally similar? (type-of 'G2016) (type-of a) Both are symbols. I guess the interpreter judges them by their situation in the world as well as their internal contents, which doesn't seem very egalitarian of it. Or perhaps the idea is like with infinities, even though both values are singular, they aren't necessarily equal? Perhaps some additional information should appear on the `equal' docstring?