Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

splicing-parameterize always yields void #4920

Open
camoy opened this issue Jan 31, 2024 · 1 comment
Open

splicing-parameterize always yields void #4920

camoy opened this issue Jan 31, 2024 · 1 comment
Labels
bug Something isn't working correctly

Comments

@camoy
Copy link
Contributor

camoy commented Jan 31, 2024

What version of Racket are you using?
e.g., 8.11.1 [cs]

What program did you run?
Please include a short example that triggers the bug

Running at the top-level with racket/splicing enabled: (splicing-parameterize () 1)

What should have happened?

Should gave back 1, as ordinary parameterize does. Instead it gives void.

Please include any other relevant details

splicing-parameterize creates a top-level variable to hold the parameterization which it then deallocates with set! as it's last expression. It's this set! that is causing the void.

@usaoc
Copy link
Contributor

usaoc commented Feb 4, 2024

This appears to be a somewhat intended behavior, because splicing-parameterize is “splicing” like begin, unless it’s in an expression context (try wrapping it in #%expression!). It’s the same as if you evaluate (begin 1 (void)) in the REPL: in reality, two forms will be spliced into the module body, but the REPL will print nothing. I’m not sure there’s an apparent “fix”.

Edit: One thing that’s really problematic, I think, is that the expansion makes it that the last definition form is no longer the last form, which changes the semantics.

Edit 2: Upon a further reflection, the above point doesn’t matter, because it only applies to top-level/module contexts.

@shhyou shhyou added the bug Something isn't working correctly label Apr 23, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working correctly
Projects
None yet
Development

No branches or pull requests

3 participants