
if I use the following for #%module-begin
in a #lang, it complains “cannot use identifier tainted by macro transformation”. why? (define-syntax-rule (test-module-begin e ...)
#'(#%module-begin
e ...))

@andreiformiga I’m not sure how exactly you’re getting that error, but you don’t want to have the #'
at the beginning if you’re using syntax-rules
.

right, is that because syntax-rules already returns a syntax object?

Yes, syntax-rules
expects to just be given a syntax template. It doesn’t expect a compile-time expression that produces a syntax object, unlike syntax-parse
.

so simple… it works now

thanks

@mflatt or @lexi.lambda: Any idea why splicing-parameterize
breaks when used with include-section
? https://gist.github.com/LeifAndersen/631eaf27dfcfcc364efc8a12ca08dc9a


What breaks about it? splicing-parameterize
won’t affect the included section because the other module is expanded independently of the including module.

The error I get is: /home/leif/racket/racket/collects/racket/splicing.rkt:492:14: splicing-parameterize-body: bad syntax
in: (splicing-parameterize-body new-parameterization (require (only-in "sec.rkt" (doc doc))))
location...:
/home/leif/racket/racket/collects/racket/splicing.rkt:492:14
context...:
do-raise-syntax-error
apply-transformer-in-context
apply-transformer52
dispatch-transformer41
loop
finish
[repeats 1 more time]
pass-1-and-2-loop
module-begin-k
expand-module16
expand-capturing-lifts
temp118_0
temp91_0
compile15
temp85_0
standard-module-name-resolver
...

Ah, include-section
is only supposed to be used at the top level of a module.

That is correct.

but require
seems to work inside a splicing-parameterize

So I guess the problem is that splicing-parameterize
isn’t ignoring things that expand into uses of require
.

I thought that.

But I made a macro that expanded to require and it worked

let me quickly dig it up.

But that code wouldn’t work, anyway—include-section
basically just expands into (require (only-in "sec.rkt" doc)) doc
, so the evaluation of doc
would not be affected by the parameterization.

Something like this:
#lang scratch
(define-syntax-parser my-req
[(_)
#'(require pict)])
(splicing-parameterize ([current-output-port (open-output-nowhere)])
(my-req))

“so the evaluation of doc
would not be affected by the parameterization”

That is correct. My actual code is a much larger block of text.

Looking at the implementation of splicing-parameterize
, it looks like the real problem is that the expansion of the begin
case is wrong. I’ll add a test and push a fix, so thanks for the report.

Where include-section
is only one part.

Gotcha.

Ah, cool. thanks. :smile:

For the record, ya, that seemed to work. Thanks again.

Can you ping me when you push and/or merge?

Will do; it shouldn’t be long.


Thanks a lot. :smile:

have a question about raco setup
: I work on small programs that aren’t packages per se, they’re CLI tools. Is there a way to use raco setup
to install the deps from info.rkt
or do I need to install them as packages first?

@d_run you need to install them as packages

but in general it’s helpful to have CLI tools installed as packages

for example, if you install my-tool
as a package, then you can run it as racket -l my-tool
anywhere

ah, got ya

thanks!