[racket-dev] generalized `begin-for-syntax'

From: Matthew Flatt (mflatt at cs.utah.edu)
Date: Thu Sep 8 18:28:34 EDT 2011

At Thu, 8 Sep 2011 17:48:46 -0400, Eli Barzilay wrote:
> Does this mean that `define-for-syntax' becomes as deprecated as
> `require-for-syntax' etc, right?

At the moment, `define-for-syntax' seems like a more useful shorthand
than `require-for-syntax', but maybe not if `for-syntax' works as
`begin-for-syntax'.

I changed the use of `define-for-syntax' in the Guide to
`begin-for-syntax', though.

> Also, does `provide' work fine in a `begin-for-syntax'?

Yes.

> Assuming that it is, it could have been nice to have it called just
> `for-syntax', since
> 
>   (for-syntax (require foo))
> 
> becomes equivalent to
> 
>   (require (for-syntax foo))

Overloading `for-syntax' in that way reminds me of the `begin' pun
(expression sequencing versus definition splicing). But maybe this one
is ok, because definitions and `require'/`provide' forms are completely
distinct positions, unlike expressions and definition sequences.

We'd have to keep `begin-for-syntax' for compatibility. Also, for
layering reasons, I think it's best to keep `begin-for-syntax' as the
core form.

I'm ambivalent overall, so I'll wait for others to chime in.



Posted on the dev mailing list.