[racket-dev] define-for-syntax optional/keyword arguments

From: Casey Klein (clklein at eecs.northwestern.edu)
Date: Wed Jun 9 09:02:01 EDT 2010

On Wed, Jun 9, 2010 at 6:52 AM, Matthew Flatt <mflatt at cs.utah.edu> wrote:
> At Tue, 8 Jun 2010 12:23:54 -0500, Casey Klein wrote:
>> `define-for-syntax' doesn't allow optional or keyword arguments,
>> although the documentation suggests it should.
>>
>> I tried to fix this myself, but I'm getting a mysterious compile error.
>> [...]
>> collects/racket/private/kw.rkt:708:46: compile: unbound identifier in
>> module (in phase 1, transformer environment) in: new-lambda
>> [...]
>>
>> I don't get the error when I `racket' the files I changed.
>> [...]
>> Is there some bootstrapping trick I need to know?
>
> There's no special bootstrapping step.
>
> The error only happens when a use of `define-for-syntax' is expanded,
> which is why directly requiring "kw.rkt" doesn't trigger an error. When
> `define-for-syntax' is used in some other module, though, it expands
> into a phase-1 use of `new-lambda', while the "kw.rkt" module context
> binds `new-lambda' only at phase 0.
>
> There's no way to define `define-for-syntax' inside of "kw.rkt". It can
> be implemented in "pre-base.rkt" by importing "kw.rkt" for syntax.
>
> I've made that change, and I'll push after building and testing.
>

Ah, that makes sense. Thanks!


Posted on the dev mailing list.