# How to parallel the mechanism of SetDelayed as in ReplaceAll that makes substitution first, then possible further evaluation?

For SetDelayed, the kernel first makes the substitution literally, then does the further evaluation process if necessary.

I always think of SetDelayed and related functions as global rule-replacing, in contrary to the local rule-replacing, namely, ReplaceAll. However, such symmetry does not correspond so parallelly.

x + x + x + x /. x -> 3


The kernel first evaluates the left hand side expression to 4 x, then applys the substitution. So my question occurs, is there a simple build-in mechanism that literally substitutes first, then does the possible further evaluation latter? If not, what is the easy and elegant way to do it by ourselves?

Another way:

Unevaluated[x + x + x + x] /. x -> 3


A couple possibilities:

Trace @ With[{x = 3}, x + x + x + x]


{With[{x=3},x+x+x+x],3+3+3+3,12}

Trace @ ReleaseHold[Hold[x + x + x + x] /. x->3]


{{{x->3,x->3},Hold[x+x+x+x]/. x->3,Hold[3+3+3+3]},ReleaseHold[Hold[3+3+3+3]],3+3+3+3,12}