* uninterned symbols as Tree-IL constants
@ 2011-08-21 0:20 BT Templeton
2011-08-21 13:25 ` Ludovic Courtès
0 siblings, 1 reply; 4+ messages in thread
From: BT Templeton @ 2011-08-21 0:20 UTC (permalink / raw)
To: guile-devel
I noticed that when uninterned symbols are used as Tree-IL constants,
they're just dumped as normal (interned) symbols, which isn't useful for
Elisp or other languages with unhygienic macro systems. Is there a
particular reason there's no special handling for uninterned symbols in
`dump-object' in `(language glil compile-assembly)'?
I've defined a `make-uninterned-symbol' VM instruction and added support
for this approach, and it works except for the somewhat unintuitive
consequence that
(let ((x (make-symbol "x"))) (eq x (eval `',x))) => nil.
--
Inteligenta persono lernas la lingvon Esperanton rapide kaj facile.
Esperanto estas moderna, kultura lingvo por la mondo. Simpla, fleksebla,
belsona, Esperanto estas la praktika solvo de la problemo de universala
interkompreno. Lernu la interlingvon Esperanton!
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: uninterned symbols as Tree-IL constants
2011-08-21 0:20 uninterned symbols as Tree-IL constants BT Templeton
@ 2011-08-21 13:25 ` Ludovic Courtès
2011-08-21 15:34 ` BT Templeton
0 siblings, 1 reply; 4+ messages in thread
From: Ludovic Courtès @ 2011-08-21 13:25 UTC (permalink / raw)
To: guile-devel
Hi,
BT Templeton <bpt@hcoop.net> 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?
Thanks,
Ludo’.
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: uninterned symbols as Tree-IL constants
2011-08-21 13:25 ` Ludovic Courtès
@ 2011-08-21 15:34 ` BT Templeton
2011-08-21 17:17 ` Ludovic Courtès
0 siblings, 1 reply; 4+ messages in thread
From: BT Templeton @ 2011-08-21 15:34 UTC (permalink / raw)
To: guile-devel
ludo@gnu.org (Ludovic Courtès) writes:
> Hi,
>
> BT Templeton <bpt@hcoop.net> 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.
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
--
Inteligenta persono lernas la lingvon Esperanton rapide kaj facile.
Esperanto estas moderna, kultura lingvo por la mondo. Simpla, fleksebla,
belsona, Esperanto estas la praktika solvo de la problemo de universala
interkompreno. Lernu la interlingvon Esperanton!
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: uninterned symbols as Tree-IL constants
2011-08-21 15:34 ` BT Templeton
@ 2011-08-21 17:17 ` Ludovic Courtès
0 siblings, 0 replies; 4+ messages in thread
From: Ludovic Courtès @ 2011-08-21 17:17 UTC (permalink / raw)
To: guile-devel
Hi,
BT Templeton <bpt@hcoop.net> skribis:
> ludo@gnu.org (Ludovic Courtès) writes:
>
>> Hi,
>>
>> BT Templeton <bpt@hcoop.net> 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’.
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2011-08-21 17:17 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-08-21 0:20 uninterned symbols as Tree-IL constants BT Templeton
2011-08-21 13:25 ` Ludovic Courtès
2011-08-21 15:34 ` BT Templeton
2011-08-21 17:17 ` Ludovic Courtès
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).