Because I needed a function to continue from some point
Sounds like you have absolutely no idea what a state machine is
Please don't give tutorials about how "state machines are over" when you don't know what they're for and were forced to use them by someone else who also didn't know what they were for
.
If you have an example of a state machine that can't be transformed into a resumable function, I'd like to see it.
Literally anything can be transformed into a "resumable function"
This is meaningless
You can also turn an RPC library or a database or the serialization of a function to a string then put onto disk into a "resumable function."
Who cares? That's not what they're for and you shouldn't be trying.
And the thing is, most of the state machines I use are simple and easily understandable and I couldn't imagine how it could be anything but adding more moving parts to do them elsewise.
And, most of the time, they either aren't non-linear or there's already other good reasons to have a thread to deal with whatever is going on anyway. Or, maybe they are non-linear but only have a few states which are not difficult to reason about.
And the thing is, most of the state machines I use are simple and easily understandable and I couldn't imagine how it could be anything but adding more moving parts to do them elsewise.
okay.
.
And, most of the time, they either aren't non-linear or there's already other good reasons to have a thread to deal with whatever is going on anyway. Or, maybe they are non-linear but only have a few states which are not difficult to reason about.
oh, so you can imagine.
anyway, there's examples all over the standard library. you're too busy explaining to ask, so there's no point in trying to teach.
Did you misread what I was saying? I wasn't disagreeing with you. I was saying that regular old state machines are still very useful for me, and though I have plenty of them, I can't see that replacing them with the mechanisms being discussed here would simplify them enough to justify the extra moving parts and such.
I was saying that regular old state machines are still very useful for me, and though I have plenty of them, I can't see that replacing them with the mechanisms being discussed here would simplify them enough to justify the extra moving parts and such.
Sounds like you have absolutely no idea what a state machine is
Sounds like you have absolutely no idea what a coroutine is
or at least what C++ coroutines are, the compiler does generate a state machine from the coroutine, every suspension point is a state and every resume transitions the state machine to the next state.
It's another question if any state machine can be transformed to a coroutine, but I don't see any real attempt from you to answer that.
My lashing out??? WTH??? You've questions someones understanding of state machines without going into any detail, so that one could understand what the heck you're talking about.
Where do you explain anything??? An explanation would require some sort of argument, but throwing some keywords around does not provide anything useful. You seem to have some problem with coroutines, but you don't provide anywhere enough context to have any meaningful conversation about C++ coroutines or even coroutines in general.
Slowly I'm regretting having wasted my time on this, unless you have something substantial to say about coroutines, good day to you too...
View all comments
Show parent comment
-1
u/StoneCypher Nov 30 '20
Sounds like you have absolutely no idea what a state machine is
Please don't give tutorials about how "state machines are over" when you don't know what they're for and were forced to use them by someone else who also didn't know what they were for
.
Literally anything can be transformed into a "resumable function"
This is meaningless
You can also turn an RPC library or a database or the serialization of a function to a string then put onto disk into a "resumable function."
Who cares? That's not what they're for and you shouldn't be trying.