Polystate is stable enough, everyone is welcome to use it

The new polystate concept is very simple and at the same time very efficient.

4 Likes

polystate support zig 0.16,After enough time of consideration, I think I have understood what it means.

Polystate is, at its core, composable goto. Zig’s label switch already gives you goto-level runtime performance — unconditional jumps with no call-stack overhead. What Polystate adds is the missing piece: the ability to compose those control-flow primitives using Zig’s type system, entirely at compile time.

State functions (generic functions that produce new state types) are the composability primitive. They let you build complex state machines by assembling smaller ones, just as functions let you build complex logic by composing simpler functions — but without sacrificing the raw performance of a hand-written state machine loop.

3 Likes