[plt-scheme] #%app literal does not match in syntax-case pattern

From: Carl Eastlund (carl.eastlund at gmail.com)
Date: Sat Nov 21 15:07:13 EST 2009

On Sat, Nov 21, 2009 at 7:13 AM, Marco Monteiro <masm at acm.org> wrote:
> On Sat, Nov 21, 2009 at 5:14 AM, Carl Eastlund <carl.eastlund at gmail.com>
> wrote:
>>
>> Marco (I almost typed "Macro" in place of your name),
>>
>> Why do you need to use "Y" to perform the recursive expansion?  Why
>> not just have your #%module-begin run local-expand on a regular
>> #%module-begin wrapped around the contents, and post-process the fully
>> expanded result?  You can go from unexpanded code to expanded code in
>> one non-recursive line of code.  Then you can emit whatever code you
>> want.  And you don't need to emit lists (in fact, emitting lists will
>> give you *bad* results with respect to hygienic macro expansion) if
>> you want "Scheme ASTs".  Syntax objects are Scheme ASTs, and have
>> source location information -- you might as well just keep the whole
>> syntax object around.  The only real work you'll need to do is
>> replacing top level expressions and the bodies of top level
>> definitions with stubs (calls to void), and that's very shallow
>> processing.
>>
>> --Carl
>
> You are right, of course. I was under the impression that local-expand only
> expands the immediate subform.
>
> I'm sorry for wasting yor time.

No waste.  I'm well aware how tricky playing games with #%module-begin
and local-expand can be.  In fact, I probably shouldn't have phrased
my statement in terms of "why do you need ..." as if you should have
known this, so sorry if I implied that.  It wasn't intentional.  Best
of luck with your compiler!

--Carl


Posted on the users mailing list.