News for hackers. Stuff that matters.
Re:State Machine in Real Life by heavenlyblue on Saturday May 02, 2020 @06:57PM (#23055545)
This is basically a switch statement :)
Re:State Machine in Real Life by jgwil2 on Saturday May 02, 2020 @07:17PM (#23055635)
If it evaluates top to bottom in an order-dependent fashion then I suppose so. If it is order independent then it's more like what I want from a state machine.
Re:State Machine in Real Life by monocasa on Saturday May 02, 2020 @07:48PM (#23055785)
What exactly are you looking for wrt to "order independent". Like, this will compile down to a computed jump table if that's what you're getting at.
Re:State Machine in Real Life by jgwil2 on Sunday May 03, 2020 @12:26AM (#23056856)
Insert new cases or change order without affecting behavior and statically check that all cases are covered. Unlike a switch statement or if else block where each condition is checked in order so adding more cases gets difficult.
Re:State Machine in Real Life by monocasa on Sunday May 03, 2020 @02:29PM (#23060901)
All Rust match statements as statically checked that all cases are covered by the compiler; you can't really turn that of even with unsafe blocks.

How are you expecting that inserting or adding statements would change behavior?