emacs-pretest-bug
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Should let symbols be interned?


From: Miles Bader
Subject: Re: Should let symbols be interned?
Date: Mon, 22 Jan 2007 19:55:29 +0900

"Lennart Borgman (gmail)" <address@hidden> writes:
>>    (let ((#1=#:my-uninterned-var 5))
>>      (+ #1# 3))
>
> Thanks. I have never seent that syntax. I guess it is "unofficial"?

I'm not really sure what you mean; it's real reader syntax, and it's
perfectly fine to use it...  It will also be output by the lisp printer
if `print-gensym' is non-nil.  See `(elisp)Output Variables' and
`(elisp)Circular Objects' in the info manual.

Basically #:SYMBOL is read like SYMBOL, except that it's not interned.
So a further occurance of #:SYMBOL will be a _different_ symbol.

> When is my-uninterned-var used in the elisp code? Only in the #:?

The #1# is actually #:my-uninterned-var (the same one as before, not a
different one with the same name).

It uses the "reference" feature of the reader, which allows you to
specify multiple references to the same lisp object in a form read by
the reader.  Here #N=FORM (where N is an integer) is read just like
FORM, except that it also associates N with FORM.  #N# is then read as
the same FORM which was read earlier.  This is useful for
printing/reading circular data structures (so the variable
`print-circle' enables printing of it), but it's also good for reading
multiple references to uninterned symbols.

-Miles

-- 
[|nurgle|]  ddt- demonic? so quake will have an evil kinda setting? one that
            will  make every christian in the world foamm at the mouth?
[iddt]      nurg, that's the goal




reply via email to

[Prev in Thread] Current Thread [Next in Thread]