Source code: https://github.com/AlexKnauth/reconstruct-template.
syntax
{ ~list/ctx ctx-idpattern...}
#<syntax:eval:2:0 1>
#<syntax:eval:2:0 2>
#<syntax:eval:2:0 3>
0
1
#f
syntax
{ ?list/ctx ctx-idtemplate...}
> stx1#<syntax:eval:2:0 (1 2 3)>
> stx2#<syntax:eval:2:0 (3 2 1)>
;same source location#t
;same syntax properties#t
;same scopes#t
The main intended use of ~list/ctx and ?list/ctx is for reconstructing syntax objects when making expanders for new core-form languages. This purpose is similar to syntax/loc/props from Alexis King’s blog post Reimplementing Hackett’s type language: expanding to custom core forms in Racket.
The main advantage of ~list/ctx and ?list/ctx over syntax/loc or syntax/loc/props is that they work even for stx-list templates nested deeply within a template, as well as for stx-list templates under ellipses. For example, if x is a well-formed let expression:
b}b}])x