Interpolate expression into macro

Some more background

In the real application, the generated expressions are accessing deeply nested fields in an object. I can either try to interpolate these expressions into a bigger expression, or turn them into functions that update the fields of interest in-place. The function approach works well, but I have to divide it into two so that the world age have time to update :confused:

These are my real-world expressions, that are constructed during runtime

set1expr = quote
    vecpartind2vec!((P2.matrix[1]).num.a, (P.matrix[1]).num.a, partind)
    vecpartind2vec!((P2.matrix[1]).den.a, (P.matrix[1]).den.a, partind)
end
set2expr = quote
    setindex!.((Pres.matrix[1]).num.a, (P2res.matrix[1]).num.a, partind)
    setindex!.((Pres.matrix[1]).den.a, (P2res.matrix[1]).den.a, partind)
end

If I make them into functions by

@eval set1fun = (P,P2,partind)-> $set1expr
@eval set2fun = (Pres,P2res,partind)-> $set2expr

I may not use the functions until the world age is updated