[plt-scheme] Inlined language from a language module
At Fri, 20 Mar 2009 13:18:52 -0400, Sam TH wrote:
> On Fri, Mar 20, 2009 at 1:02 PM, Jay McCarthy <jay.mccarthy at gmail.com> wrote:
> > On Fri, Mar 20, 2009 at 10:54 AM, Matthew Flatt <mflatt at cs.utah.edu> wrote:
> >> (define-syntax (with-mini stx)
> >> (syntax-case stx ()
> >> [(_ expr)
> >> #`(begin
> >> (require "mini.ss")
> >> #,(strip-context #'expr))]))
> >
> > Am I right to assume this only works at the top-level because it
> > relies on require?
>
> I think this definition of `with-mini' should work:
>
> (define-syntax (with-mini stx)
> (syntax-case stx ()
> [(_ expr)
> (syntax-local-lift-require "mini.ss"
> (strip-context #'expr))]))
>
> but it doesn't seem to:
>
> compile: unbound identifier (and no #%app syntax transformer is bound) in: 1+
I tried that too....
The problem is that `strip-context' removes the lexical context that
includes `require's --- even the `require's introduced by
`syntax-local-lift-require'.