News for hackers. Stuff that matters.
Re:Using enums to represent state in Rust by taeric on Friday September 22, 2023 @11:20AM (#37613204)
Agreed. I've actually been criticized at several positions for a big "manage_transition" function that is basically either chained if statements or a switch. Either is fine as long as you keep it linear and organized. Both can be terrible if you don't do those things. But, most alternatives can get unwieldy for the same reasons.

The worst is when someone refactors it into a "modern" approach and then proceeds to break the general flow of the state machine again and again.

There are no comments on this comment yet.