I encountered a surprising identifier binding ambiguity error when using splicing-local
within the body of another splicing-local
. Am I misusing splicing-local
, or is this a bug?
Here's a small reproduction of the problem:
;;; splicing-bug.rkt
#lang racket/base
(require racket/splicing)
;; This one works.
;(splicing-local
; ((define one 0)
; (define (two) one))
; 3)
;; This one produces an error:
(splicing-local
()
(splicing-local
((define one 0)
(define (two) one))
3))
;> racket splicing-bug.rkt
;splicing-bug.rkt:16:19: one: identifier's binding is ambiguous
; in: one
; context...:
; #(536 intdef-outside) #(537 intdef) #(538 intdef-outside)
; #(539 intdef) #(735 intdef-outside) #(736 intdef) #(747 local)
; #(748 intdef) [common scopes]
; matching binding...:
; #(one.1 #<module-path-index='splicing-bug[253]> 0)
; #(735 intdef-outside) #(736 intdef) [common scopes]
; matching binding...:
; local
; #(536 intdef-outside) #(537 intdef) #(538 intdef-outside)
; #(539 intdef) [common scopes]
; common scopes...:
; #(9 module) #(467 module splicing-bug) #(612 intdef)
; location...:
; splicing-bug.rkt:16:19