syntax-local-get-shadower does not work in splicing-let
Nobody has claimed this yet.
- Dominant language
- Racket
- Stars
- 5.2k
- Forks
- 698
- Avg merge
- 18h 34m
- Merged PRs (30d)
- 5
Description
#lang racket
(require racket/splicing)
(define-syntax (expand-to-b stx)
(syntax-local-get-shadower
(datum->syntax #f 'b)))
(define b 1)
(splicing-let ([b 2])
(expand-to-b))
;; => Incorrectly prints 1
(let ([b 2])
(expand-to-b))
;; => Prints 2
My understanding is that splicing-let-body expands the body using local-expand, but does not specify an intdef-ctx argument.
I think the fix inside splicing-let-body would be to use syntax-local-make-definition-context to create a new definition context, then syntax-local-bind-syntaxes to bind rename transformers to the local variables in that internal definition context, and use it as the fourth argument to the local-expand call. All the body ... would have to be expanded using the same internal definition context.
Can someone confirm that this sounds like the right fix? If so, I can give it a shot and send a pull request, but I'd like confirmation that there isn't any reason to not proceed like that.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with racket/collects/racket/splicing.rkt, especially splicing-let-body and its local-expand call. Run the reproducer from the issue first, then inspect how the splicing-let body and each body form are expanded. Done means syntax-local-get-shadower resolves the spliced local binding as b=2 while ordinary let behavior remains unchanged.
Written by the indexing model from the issue text.
Assessment
- Domain
- compilers
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100