[Top][All Lists]

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

Re: Avoiding variable clashes

From: Noah Lavine
Subject: Re: Avoiding variable clashes
Date: Thu, 14 Apr 2011 09:13:10 -0400

>> The fact that we represent different variables as gensyms is an
>> implementation detail, and unimportant. (In fact, I might like to
>> change that detail at some point to get better error messages, but
>> it's not high on my to-do list.)
> What are you referring to here?

It's just part of my mental image of how variables work. I think of
the key idea as there being different "variable objects", or perhaps
"slots", even for variables referenced by the same symbol. We
implement that by assigning a unique gensym to each variable object, I
think, but you could assign a unique anything to each variable object
and it would work just as well. Is that an accurate picture of how
Guile works?

When I said I might like to change that, I was thinking of a thread a
while ago about how to handle top-level variables defined in macros.
It seems to me that instead of having a gensym object for each
separate variable, you might want a pair of (symbol . macro), where
symbol is the name of the variable and macro is the macro expansion it
came from. Then you could print stack traces or error messages with
information like "variable x (from the third expansion of (while)

I haven't really thought through the idea much though. As I said, it's
not high on my to-do list.

reply via email to

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