guile-devel
[Top][All Lists]
Advanced

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

Re: uninterned symbols as Tree-IL constants


From: Ludovic Courtès
Subject: Re: uninterned symbols as Tree-IL constants
Date: Sun, 21 Aug 2011 19:17:07 +0200
User-agent: Gnus/5.110018 (No Gnus v0.18) Emacs/24.0.50 (gnu/linux)

Hi,

BT Templeton <address@hidden> skribis:

> address@hidden (Ludovic Courtès) writes:
>
>> Hi,
>>
>> BT Templeton <address@hidden> skribis:
>>
>>> I noticed that when uninterned symbols are used as Tree-IL constants,
>>
>> I thought literal (constant) symbols in Elisp were interned.  You seem
>> to imply this isn’t always the case; can you explain?
>
> Since Elisp lacks hygienic macros, macros typically use uninterned
> symbols for variable names used in their expansions in order to avoid
> name clashes.

Oh, OK.  With our good ol’ defmacro, common practice was to use gensym
instead.

> There are also a couple other ways to use uninterned symbols as
> literals: you can use `eval', and Elisp supports Common Lisp's `#:foo'
> syntax. Sharpsign-colon is rare in Elisp, but potentially useful for
> testing special forms without polluting the global namespace:
>
>   (progn
>     '#1=#:foo
>     (setq #1# 42)
>     #1#) ; => 42

Hmm, thanks for explaining.

Then yes, it makes sense to add a VM instruction for uninterned symbols
(it should be at the end of the instruction list to avoid polluting the
native instruction cache.)

Feel free to submit the patch if you want it to be applied to ‘master’.

Thanks,
Ludo’.




reply via email to

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