Advanced user tip: interacting with Scheme modules

Sometimes while investigating TeXmacs Scheme code, I want to temporarily alter or test functions and variables in modules that have not been globally defined (via define, not tm-define).

For example, the file TeXmacs/progs/kernel/logic/logic-rules.scm contains a hash table logic-rules-table, which is local to the module. If you do logic-rules-table in a Scheme session, you will get unbound variable logic-rules-table.

However, you can do the following:
(with-module (resolve-module '(kernel logic logic-rules)) logic-rules-table)
This will execute your command in the desired module.

Hope this may be useful to some. Let me know your tips for Scheme coding!

Thanks. I think that with Guile one can also use the form (@@ (kernel logic logic-rules) logic-rules-table) to access private symbols. (haven’t checked lately, but at some point it worked) See: https://www.gnu.org/software/guile/manual/html_node/Using-Guile-Modules.html

1 Like

Thanks, yes, that still works!

1 Like