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?


_______________________________________________
Help-gnu-emacs mailing list
Help-gnu-emacs@gnu.org
http://lists.gnu.org/mailman/listinfo/help-gnu-emacs

Reply via email to