Consider the following code.
\setbox0 \hbox{XXX}
\fbox{\copy0}
{
\setbox0\hbox{ZZZ}
{\wd0 0pt}
\fbox{\copy0}
}
\fbox{\box0}
This produces three ruled boxes. The two XXXs are inside the rules, the ZZZ is not.
After \wd0 0pt, box 0 has width 0 and this assignment is global which explains why ZZZ is not entirely inside the rules. At the same time, the assignment is local in that it doesn't affect the box 0 which contains the XXX.
What is the purpose of this behavior? Alternatively, what is the utility of being able to set the dimensions of boxes outside the current group?
Edit: To be clear, this was not a question about what the behavior is, it was a question about why Knuth gave TeX this behavior. I thought there might be a use for it that I didn't see since TeX by Topic explicitly mentions it. My suspicion now is that Taco's comment about it being merely an implementation detail, not a design goal, is the right answer.

