Hacker News new | ask | show | jobs
by azornathogron 859 days ago
State is data that you use in control flow decisions.

(This is a 5-second reaction, not a deeply considered opinion, don't take it too seriously)

3 comments

I like it! I don't know if I agree, but, the category of "data used in control flow" is a good one.

I think... maybe this definition needs a narrower category of control flow? Like, technically, if you're converting 24-hour time to 12-hour AM/PM time, you have control flow (if > 12 hours). IMO that seems like it shouldn't be state. But, "we've delivered this message, so don't try to deliver it again" definitely involves control flow and definitely feels like state. Something like "this list is sorted" is in-between; it's re-computable (easily, depending on list size), if it's not done you want to do it, but after that it doesn't affect control flow.

Maybe the difference is "control flow that modifies other data"?

> (This is a 5-second reaction, not a deeply considered opinion, don't take it too seriously)

If you have to put a disclaimer that basically invalidates your statement, why make the statement at all?

It doesn't invalidate it, it offers context.
This is the correct formulation.

I also have a blog post coming out tomorrow with a bit of justification for this.