variables.scm 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. (define-module (lang elisp variables))
  2. ;;; The only purpose of this module is to provide a place where the
  3. ;;; variables holding Elisp function definitions can be bound to
  4. ;;; symbols.
  5. ;;;
  6. ;;; This can be useful when looking at unmemoized procedure source
  7. ;;; code for Elisp functions and macros. Elisp function and macro
  8. ;;; symbols get memoized into variables. When the unmemoizer tries to
  9. ;;; unmemoize a variables, it does so by looking for a symbol that is
  10. ;;; bound to that variable, starting from the module in which the
  11. ;;; function or macro was defined and then trying the interfaces on
  12. ;;; that module's uses list. If it can't find any such symbol, it
  13. ;;; returns the symbol '???.
  14. ;;;
  15. ;;; Normally we don't want to bind Elisp function definition variables
  16. ;;; to symbols that are visible from the Elisp evaluation module (lang
  17. ;;; elisp base), because they would pollute the namespace available
  18. ;;; to Elisp variables. On the other hand, if we are trying to debug
  19. ;;; something, and looking at unmemoized source code, it's far more
  20. ;;; informative if that code has symbols that indicate the Elisp
  21. ;;; function being called than if it just says ??? everywhere.
  22. ;;;
  23. ;;; So we have a compromise, which achieves a reasonable balance of
  24. ;;; correctness (for general operation) and convenience (for
  25. ;;; debugging).
  26. ;;;
  27. ;;; 1. We bind Elisp function definition variables to symbols in this
  28. ;;; module (lang elisp variables).
  29. ;;;
  30. ;;; 2. By default, the Elisp evaluation module (lang elisp base) does
  31. ;;; not use (lang elisp variables), so the Elisp variable namespace
  32. ;;; stays clean.
  33. ;;;
  34. ;;; 3. When debugging, a simple (named-module-use! '(lang elisp base)
  35. ;;; '(lang elisp variables)) makes the function definition symbols
  36. ;;; visible in (lang elisp base) so that the unmemoizer can find
  37. ;;; them, which makes the unmemoized source code much easier to read.
  38. ;;;
  39. ;;; 4. To reduce the effects of namespace pollution even after step 3,
  40. ;;; the symbols that we bind are all prefixed with `<elisp' and
  41. ;;; suffixed with `>'.