<HTML><FONT FACE=arial,helvetica><FONT  SIZE=2 FAMILY="SANSSERIF" FACE="Arial" LANG="0">Hi!<BR>
<BR>
<BLOCKQUOTE TYPE=CITE style="BORDER-LEFT: #0000ff 2px solid; MARGIN-LEFT: 5px; MARGIN-RIGHT: 0px; PADDING-LEFT: 5px">&gt; The full example is rather long, but complains:<BR>
&gt;&nbsp;&nbsp; compile: bad syntax; function application is not allowed, because no #%app <BR>
&gt; syntax transformer is bound in: ...<BR>
<BR>
After giving it some thought, I don't have any good guesses.</BLOCKQUOTE><BR>
<BR>
I have managed to fix my macro, but also to formulate a far more consise example of this problem (given below). In the following example, if I "inline" the helper in my macro, everything behaves correctly. But in the case below, I get the following error when my macro is used within a module:<BR>
a.ss:8:5: compile: bad syntax; function application is not allowed, because no #%app syntax transformer is bound in: (cons 1 2)<BR>
<BR>
As before, when this macro is used in the REPL in DrScheme, the macro "works". In this case, the macro is expanded, and the result is evaluated to (1 . 2) as one would expect.<BR>
<BR>
The trick to fixing my complte define-struct/prop macro was to move the "helper" code into the body of my syntax case macro.<BR>
<BR>
In principle, I could, sort of, understand that there is a problem with referencing a binding of cons in an instantiation of mzscheme in a different phase, and feeding this syntax object back to the value-time environment of module c. But why does it "work" in the REPL, if that is the case?<BR>
<BR>
Jim<BR>
<BR>
---------------------------<BR>
; c.ss<BR>
<BR>
(module c mzscheme<BR>
&nbsp; <BR>
&nbsp; (require "b.ss")<BR>
&nbsp; <BR>
&nbsp; (my-cons 1 2))<BR>
<BR>
---------------------------<BR>
; b.ss<BR>
<BR>
(module b mzscheme<BR>
&nbsp; <BR>
&nbsp; (provide my-cons)<BR>
&nbsp; <BR>
&nbsp; (require-for-syntax "a.ss")<BR>
&nbsp; <BR>
&nbsp; (define-syntax (my-cons stx)<BR>
&nbsp;&nbsp;&nbsp; (syntax-case stx ()<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ((_ a b)<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; (helper #`a #`b)))))<BR>
<BR>
---------------------------<BR>
; a.ss<BR>
<BR>
(module a mzscheme<BR>
&nbsp; <BR>
&nbsp; (provide helper)<BR>
&nbsp; <BR>
&nbsp; (define (helper first rest)<BR>
&nbsp;&nbsp;&nbsp; #`(cons #,first #,rest)))<BR>
</FONT></HTML>