I was thinking about possible syntax for it to be a language feature and looked at some other languages. There's a language in development by Jonathan Blow for game development called Jai that has this feature. The syntax he chose is:
[scopedVarA, scopedVarB] {
// function body
}
where only scopedVarA and scopedVarB would be accessible inside the function body