Thank you for your report. I have forwarded your report to the appropriate team for review. - WRI
G[x_] := With[{a = 0}, With[{b = x}, a]]
G @ 0
F[x_] := With[{a = 0}, {b = x}, a]
F @ 0
gives
0
a
I would expect both to behave exactly the same.
It seems that referring to the parameter x
invalidates any amount of previously defined variables, but none that come after:
F[x_] := With[{a = 0}, {s = 0}, {b = x}, {t = 0}, {w = 0}, {a, s, b, t, w}]
F @ 0
{a, s, 0, 0, 0}
Manually nested With
or LetL
don't have this problem:
F[x_] := LetL[{a = 0, s = 0, b = x, t = 0, w = 0}, {a, s, b, t, w}]
F @ 0
{0, 0, 0, 0, 0}
Referring to an earlier variable is also no problem
F[x_] := With[{a = 0}, {s = 0}, {b = a}, {t = 0}, {w = 0}, {a, s, b, t, w}]
F @ 0
{0, 0, 0, 0, 0}
Referring to Module
variables gives the same problem:
H[] :=
Module[{x = 0},
With[{a = 0}, {s = 0}, {b = x}, {t = 0}, {w = 0}, {a, s, b, t, w}]]
H[]
This must be a bug in this undocumented feature. Maybe it has to do with the renaming that takes place.