Hi, I am trying to implement my edsm-engine (written for Linux in C long time ago) in Zig.
Here is what I have for the moment.
Some general words about event driven SMs as a programs design methodology as I see it:
- combining event driven approach with state machines gives fine grained concurrency within single thread
- and so can be used as an alternative to coroutines/fibers/greenlets (without compiler support)
- as soon as you’ve drawn state diagrams for all types of machines needed by a program you automatically have a structure for the code (each transition is a couple of functions/methods, each reaction without state change is a function/method)
Since I’ve started to learn Zig only about a couple of months ago any critical comments regarding using (or misusing) the language are welcome.