3 ms·
State machines are still and by far most commonly used in C, where, lo and behold, most low-level and embedded programming is still done. And function pointers
by bmarkovic 9y ago
State machines are still and by far most commonly used in C, where, lo and behold, most low-level and embedded programming is still done.
And function pointers make up for pretty much the only fundamentally useful aspect of FPs regarding FSMs which is functions as first-class objects.
Everything else pretty much just substitutes one convenience for another. A pretty good case can be made about how the State Pattern makes traditional OOP indispensable in FSM design, and I'm sure that in OO languages with functions as first class objects (like Python, Lua or Javascript) people can showcase elegant designs that to them far surpass both classically OO or classically FP designs etc. etc.
- naasking 9y ago> And function pointers make up for pretty much the only fundamentally useful aspect of FPs regarding FSMs which is functions as first-class objects. I'd argue sums and pattern matching are almost as important given the simplicity of expression.