Some day I will learn how TeX actually works; in the meantime I ask here
gets stuck in an infinite loop, producing some thousands pages in a few seconds (as I expected). On the other hand, the snippet
results in the error
! TeX capacity exceeded, sorry [main memory size=5000000]. \x ->Hello !\x
I would like to understand this behaviour. If I think just about macro expansion, I expect an infinite loop also in the latter situation: obviously this is not true, and issuing a new paragraph influences things.