The point of having a macro \eval{...}
is (I guess) to ensure the scaling (which I don't like in general). It would be possible to patch \pdv
such that it saves the height of the whole construct in a length register which is later used to build the par, but I don't like and I don't use the physics
package. Furthermore, automatic scaling is in general very dangerous as you see in the following example
\[
\left.\frac{\partial f}{\partial x}\right|_x
\left.\frac{\partial \tilde{f}}{\partial x}\right|_x
\]

I believe there is no doubt that the second expression looks appalling.
Honestly, I see no big difference in having something which works as
\frac{dy}{dx}\eval_x
over the more direct
\frac{dy}{dx}\biggr|_x
except sparing two keystrokes and making the code IMO less legible (though the latter comment might depend on how my eyes and brain parse LaTeX math). But if your \eval
almost always have the same height (say \bigg
) then you could define something like this
\documentclass{article}
\makeatletter
\newcommand*{\eval}[1][\bigg]{%
\if\relax\detokenize{#1}\relax
\def\next{\mathclose|}%
\else
\def\next{\csname\expandafter\@gobble\string#1r\endcsname|}%
\fi
\next
}
\makeatother
\begin{document}
\[
\frac{\partial f}{\partial x}\eval_x \quad
a\eval[\big]_x \quad
a\eval[]_x \quad
\frac{\partial f}{\partial x}\eval[\Bigg]_x^y
\]
\end{document}

By default \bigg
is used; different sizes can be given as optional parameter.
\left. f(x) \right\rvert_{x=x_0}
for this. You could wrap this in a macro if necessary, too.