[plt-scheme] Another syntax issue

From: Lauri Alanko (la at iki.fi)
Date: Thu Aug 15 18:08:59 EDT 2002

Sorry for not coming up with a more descriptive subject. :)

The issue is with syntax objects generated by transformer environment
code outside of define-syntax:

Welcome to MzScheme version 200, Copyright (c) 1995-2002 PLT
> (module foo mzscheme (provide bar) (define (bar stx) (syntax-case stx () ((_ a) #'(list a)))))
> (require-for-syntax foo)                                              
> (define-syntax baz bar)                                               
> (baz 1)                                                               
STDIN::81: compile: bad syntax; function application is not allowed, because no #%app syntax transformer is bound in: (list 1)

I can sort of understand why this happens: module foo is defined at
stage 1, and the syntax objects generated in it refer to stage 0, which
has not been defined at all for this instance of foo and is thus empty.
Right?

What I can't figure out is how to fix the problem. How can I write a
module that has functions (not macros) that generate syntax objects that
refer to a meaningful environment? Until define-for-syntax becomes
available, auxiliary syntactic manipulation functions have to be written
in a separate module, and it's troublesome if those auxiliary functions
cannot use any "verbatim" identifiers.

Any suggestions?


Lauri Alanko
la at iki.fi




Posted on the users mailing list.