Mon Mar 10 23:06:32 CET 2008
getting at the names..
got something that works:
;; Get to the exported names by requiring the module into an empty
;; namespace which has the base module attached to its registry.
(define (get-names path)
(let ((n (make-base-empty-namespace)))
still stuck at some #%app problem further down the line, but the names
wait.. what a mess! the previous one did work, and the current one
doesn't (needs absolute paths).. get-module-code is ok.
this seems to be problematic:
(define (define-ns-tx stx)
(syntax-case stx ()
((_ ns name val)
(let ((mapped (ns-prefixed #'ns #'name)))
#`(define #,mapped val)))))
the name created here 'mapped' is not recognized as a module-local one.
(define-syntax (foo stx)
(define (foo-tx stx)
#`(+ 1 2))
box> (require "broem.ss")
broem-tx.ss:4:4: compile: bad syntax; function application is not allowed, because no #%app syntax transformer is bound in: (+ 1 2)
=== context ===
the thing that's missing here is the (require (for-template
scheme/base)) in broem-tx.ss
so it seems that now the remaining problems are because some names are
expanded to toplevel form because they are not visible somehow?
(define foo 123)
(define-syntax (broem stx)
(printf "compiling broem\n")
#`(define lala #,'foo))
(provide foo broem lala)
that doesn't create the lala symbol.. why?