This is the mail archive of the guile@cygnus.com mailing list for the guile project.
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |
Bernard URBAN writes: > The way intern and friends work is also largely mysterious to me. > Added to module, it is a real nightmare. For the sake of hobbit, > having intern well explained and a C interface to modules would help a > lot. If anyone is listening to that... >From ghobbit.h, we have #define intern(x,y) scm_permanent_object(scm_intern((x),(y))) The function scm_intern() is defined in libguile/symbols.c, and takes symbol name (as char *) and length. The symbol is hashed into obarray `scm_symhash', then bound to a newly created variable. Finaly, the pair (NAME . VALUE) is returned. If the symbol was already in the obarray, its name and value are used immediately (w/o creating a new variable). This is why the alias `my_car' looks at the `cdr' of the call to `intern'. Because the C macro `intern' uses `scm_intern', there is no module interaction; whoever has access to `scm_symhash' can see the symbol/variable. Whether or not this means that hobbit runtime needs to be in the module that sees `scm_symhash' is not known to me. thi