Where is the name of the symbol kept? Is it in the struct
or in another hash table that you lookup using the id?
The names are stored in another hash table.
Also, how is "eq?" implemented in IronScheme? And how does
string->symbol work?
A string to symbol hashtable, where a symbol is effectively an integer.
So eq? in the case of symbols, cannot do a reference equality check (same
memory location). It needs to check both id's are the same. For all other
objects eq? uses a reference equality check.
This is a problem in the design, one that I would like to address at some
stage.
The value (if any) of the symbol is kept in a hash table.
Do you do this lookup every time you need the value of a
symbol? So, if you import some variable x with location
x$n (a gensym) from a library, how do you implement or
compile the variable reference?
They will be looked up initially and placed in a local (to this
compilation/module) 'wrapper' object containing the value. However, if the
value is changed via set-symbol-value! the 'wrapper' object's value is
updated too. The code within that compilation/module will always refer to
variables via those 'wrapper' objects.
So basically it looks up variables via symbol-value.
So do you mean with unintern, basically remove the value
from the symbol?
No, not remove the value. In Ikarus, it would be removing
the symbol from the symbol table so that subsequent read
operations (or string->symbol) would return a new symbol,
rather than returning the old one. I won't know how that
would work in IronScheme until I understand how it works.
I kind of understand, but that I am not sure if that will be completely
possible.
Maybe if I see what you come up with, I can see how it would work?
Cheers
leppie