>> 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.