test-use-before-definition.rkt (498B)
1 #lang racket 2 (require subtemplate/override 3 rackunit) 4 5 ;; f is defined after xᵢ 6 (check-equal? 7 (let () 8 (define/with-syntax (xᵢ …) #'(a b c)) 9 (define (f) (list zᵢ ... (syntax->datum (subtemplate (yᵢ …))))) 10 (f)) 11 '(a/z b/z c/z (a/y b/y c/y))) 12 13 ;; f is defined before xᵢ (still works, yay!) 14 (check-equal? 15 (let () 16 (define (f) (list zᵢ ... (syntax->datum (subtemplate (yᵢ …))))) 17 (define/with-syntax (xᵢ …) #'(a b c)) 18 (f)) 19 '(a/z b/z c/z (a/y b/y c/y)))