andreiformiga
2018-12-13 17:45:18

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 ...))


lexi.lambda
2018-12-13 18:18:54

@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.


andreiformiga
2018-12-13 18:20:12

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


lexi.lambda
2018-12-13 18:21:02

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.


andreiformiga
2018-12-13 18:21:27

so simple… it works now


andreiformiga
2018-12-13 18:21:41

thanks


leif
2018-12-13 20:16:30

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


leif
2018-12-13 20:16:31

lexi.lambda
2018-12-13 20:17:09

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


leif
2018-12-13 20:17:21

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 ...


lexi.lambda
2018-12-13 20:17:36

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


leif
2018-12-13 20:17:49

That is correct.


leif
2018-12-13 20:18:10

but require seems to work inside a splicing-parameterize


lexi.lambda
2018-12-13 20:18:30

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


leif
2018-12-13 20:19:19

I thought that.


leif
2018-12-13 20:19:30

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


leif
2018-12-13 20:19:36

let me quickly dig it up.


lexi.lambda
2018-12-13 20:19:43

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.


leif
2018-12-13 20:21:07

Something like this:

#lang scratch

(define-syntax-parser my-req
  [(_)
   #'(require pict)])

(splicing-parameterize ([current-output-port (open-output-nowhere)])
  (my-req))

leif
2018-12-13 20:21:47

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


leif
2018-12-13 20:21:56

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


lexi.lambda
2018-12-13 20:22:02

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.


leif
2018-12-13 20:22:06

Where include-section is only one part.


lexi.lambda
2018-12-13 20:22:18

Gotcha.


leif
2018-12-13 20:22:21

Ah, cool. thanks. :smile:


leif
2018-12-13 20:23:43

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


leif
2018-12-13 20:24:02

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


lexi.lambda
2018-12-13 20:25:14

Will do; it shouldn’t be long.



leif
2018-12-13 20:55:01

Thanks a lot. :smile:


d_run
2018-12-13 22:19:21

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?


samth
2018-12-13 22:22:33

@d_run you need to install them as packages


samth
2018-12-13 22:22:52

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


samth
2018-12-13 22:23:19

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


d_run
2018-12-13 22:23:30

ah, got ya


d_run
2018-12-13 22:23:32

thanks!