3 ms·
>I'd say you achieve this by passing whatever bit of state data you need to drive the behavior in the various calls to functions A and B. Obviously you can do
by foldr 17y ago
>I'd say you achieve this by passing whatever bit of state data you need to drive the behavior in the various calls to functions A and B.
Obviously you can do that. The author mentions this possibility. But his point is that passing the state around may involve adding extra parameters to a very large number of functions, which is much more difficult than just using a global variable.
It seems odd to me to say that faking global variables by clumsy manual state threading is cleaner than just using global variables. It is more error-prone, more verbose, and less indicative of program structure and programmer intent.