[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Lisp help: problem with uninterned symbols
From: |
Lars Brinkhoff |
Subject: |
Re: Lisp help: problem with uninterned symbols |
Date: |
12 Dec 2003 22:59:32 +0100 |
User-agent: |
Gnus/5.0808 (Gnus v5.8.8) Emacs/20.7 |
Pascal Bourguignon <spam@thalassa.informatimago.com> writes:
> One question: why don't you use an obarray for you symbols?
I may do that I the future, but one problem (I believe) is that it's
not possible to intern the same symbol in more than one obarray.
> (I doubt that would change anything thought).
No, I don't think so.
> Otherwise, I'm afraid you'll have to extend the emacs byte compiler
> to allow it to work with various sources of "interned" symbols.
Something like Common Lisp's load-time-value would be nice. My
problem would then be solved by wrapping (load-time-value ...) around
the difficult parts.
Building on Stefan's suggestion, how about this?
(defvar load-time-value-list)
(defmacro start-load-time-values ()
"This macro must be called before the first use of load-time-value."
(setq load-time-value-list nil))
(defmacro end-load-time-values ()
"This macro must be called after the last use of load-time-value."
`(progn ,@(mapcar (lambda (x) `(defvar ,@x))
load-time-value-list)))
(defmacro load-time-value (form &optional read-only-p)
(if byte-compile-current-form
(let ((sym (gentemp)))
(push (list sym form) load-time-value-list)
sym)
form))
Note the use of gentemp instead of gensym.
--
Lars Brinkhoff, Services for Unix, Linux, GCC, HTTP
Brinkhoff Consulting http://www.brinkhoff.se/
Re: Lisp help: problem with uninterned symbols, Stefan Monnier, 2003/12/12