Put local variables for Block in a variable
This could be another case for the injector pattern:
var = Hold@{x = 2, y = 3, z = 4}
var /. Hold[inj_] :> Block[inj, x*y*z]
(*24*)
?x
(*Global`x --- so we did not leak*)
Here's something I found:
With[{h := {x = 7, y = 8}},
Block[h, x y]]
56
The way I prefer is
var := {x = 2, y = 3, z = 4}
ReleaseHold[Hold[Block[var, x*y*z]] /. OwnValues[var]]
x
-> 24
-> x
Or
Apply[Block, Hold[var, x*y*z] /. OwnValues[var]]
x
-> 24
-> x
For
hVars = Hold[{x = 2, y = 3, z = 4}];
We can do
ReleaseHold[Hold[Block][hVars, Hold[x*y*z]]]
x
-> 24
-> x