News for hackers. Stuff that matters.
Re:Facts about State Machines by thebruce87m on Saturday October 01, 2022 @05:29PM (#33050300)
My states have entry() and exit() functions that do things like you describe.
Re:Facts about State Machines by anonymous_sorry on Saturday October 01, 2022 @06:52PM (#33050934)
Lets say a PR can go from:

Draft->Closed/Abandoned

Draft->In Review

Changes Requested->In Review

I'm not sure "assign reviewer" would fit either in Draft.exit() or InReview.entry(). I guess you'd implement something like "ensure reviewer assigned" in InReview.entry() instead. Which would work, but would itself contain the sort of state-dependent logic that a state machine is meant to surface.

Re:Facts about State Machines by thebruce87m on Sunday October 02, 2022 @03:36AM (#33053803)
Putting it in the entry is probably what I’d do, or I’d split the “InReview” state into its own sub state machine. It’s hard to reason exactly with imaginary scenarios though.