[plt-scheme] syntax identifier used out of context
Matthew Flatt wrote:
> You could move `bar2' out of `foo' using `define-for-syntax',
>
> (define-for-syntax (bar2 stx3)
> (syntax-case stx3 ()
> ((_ q) #'(+ 1 q))))
>
> and then it works to replace the lambda with `bar2', as you expected.
>
I was thinking about this a little more and wondered why it was
necessary to move `bar2' out of `foo'. If I define `bar2' inside `foo'
then aren't I defining it in a transformer environment?
If not, then what does `define-for-syntax' do that it can only be used
at the top-level (or I guess module-level really).