1
Fork 0
mirror of https://git.savannah.gnu.org/git/guile.git synced 2025-05-22 04:30:19 +02:00

allow defmacros to unquote in macros into expanded expressions

* module/language/scheme/compile-ghil.scm (lookup-transformer): Allow
  macros to be unquoted into the car of any form that results from macro
  expansion. This lets modules export defmacros built on other defmacros
  that are not exported.
This commit is contained in:
Andy Wingo 2009-02-09 11:50:58 +01:00
parent 9892287960
commit 277f728b14

View file

@ -89,12 +89,17 @@
;; FIXME shadowing lexicals?
(define (lookup-transformer head retrans)
(let* ((mod (current-module))
(val (and (symbol? head)
(val (cond
((symbol? head)
(and=> (module-variable mod head)
(lambda (var)
;; unbound vars can happen if the module
;; definition forward-declared them
(and (variable-bound? var) (variable-ref var)))))))
(and (variable-bound? var) (variable-ref var)))))
;; allow macros to be unquoted into the output of a macro
;; expansion
((macro? head) head)
(else #f))))
(cond
((hashq-ref *translate-table* val))