From mboxrd@z Thu Jan 1 00:00:00 1970 Path: main.gmane.org!not-for-mail From: Lars Brinkhoff Newsgroups: gmane.emacs.help Subject: Re: Lisp help: problem with uninterned symbols Date: 12 Dec 2003 22:59:32 +0100 Organization: nocrew Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Message-ID: <85fzfp66kb.fsf@junk.nocrew.org> References: <87smjqoyy0.fsf@thalassa.informatimago.com> <87fzfqot0m.fsf@thalassa.informatimago.com> NNTP-Posting-Host: deer.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: sea.gmane.org 1071266731 5362 80.91.224.253 (12 Dec 2003 22:05:31 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Fri, 12 Dec 2003 22:05:31 +0000 (UTC) Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Fri Dec 12 23:05:27 2003 Return-path: Original-Received: from monty-python.gnu.org ([199.232.76.173]) by deer.gmane.org with esmtp (Exim 3.35 #1 (Debian)) id 1AUvPb-0005E5-00 for ; Fri, 12 Dec 2003 23:05:27 +0100 Original-Received: from localhost ([127.0.0.1] helo=monty-python.gnu.org) by monty-python.gnu.org with esmtp (Exim 4.24) id 1AUwMA-0002Ao-MS for geh-help-gnu-emacs@m.gmane.org; Fri, 12 Dec 2003 18:05:58 -0500 Original-Received: from list by monty-python.gnu.org with tmda-scanned (Exim 4.24) id 1AUwLJ-00029n-OO for help-gnu-emacs@gnu.org; Fri, 12 Dec 2003 18:05:05 -0500 Original-Received: from mail by monty-python.gnu.org with spam-scanned (Exim 4.24) id 1AUwKm-0001zz-Ik for help-gnu-emacs@gnu.org; Fri, 12 Dec 2003 18:05:03 -0500 Original-Received: from [199.232.41.8] (helo=mx20.gnu.org) by monty-python.gnu.org with esmtp (TLSv1:DES-CBC3-SHA:168) (Exim 4.24) id 1AUwKm-0001vT-BP for help-gnu-emacs@gnu.org; Fri, 12 Dec 2003 18:04:32 -0500 Original-Received: from [80.91.224.249] (helo=main.gmane.org) by mx20.gnu.org with esmtp (Exim 4.24) id 1AUvK8-00051Y-5H for help-gnu-emacs@gnu.org; Fri, 12 Dec 2003 16:59:48 -0500 Original-Received: from list by main.gmane.org with local (Exim 3.35 #1 (Debian)) id 1AUvJu-0000Fo-00 for ; Fri, 12 Dec 2003 22:59:34 +0100 X-Injected-Via-Gmane: http://gmane.org/ Original-To: help-gnu-emacs@gnu.org Original-Received: from sea.gmane.org ([80.91.224.252]) by main.gmane.org with esmtp (Exim 3.35 #1 (Debian)) id 1AUvJs-0000Ff-00 for ; Fri, 12 Dec 2003 22:59:32 +0100 Original-Received: from news by sea.gmane.org with local (Exim 3.35 #1 (Debian)) id 1AUvJs-0001BH-00 for ; Fri, 12 Dec 2003 22:59:32 +0100 Original-Lines: 42 Original-X-Complaints-To: usenet@sea.gmane.org User-Agent: Gnus/5.0808 (Gnus v5.8.8) Emacs/20.7 X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.2 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: main.gmane.org gmane.emacs.help:15213 X-Report-Spam: http://spam.gmane.org/gmane.emacs.help:15213 Pascal Bourguignon 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/