Hacker News new | ask | show | jobs
by alwaysbeconsing 818 days ago
Sum type is key, called "discriminated union" sometimes generally. In Rust this is an `enum`. Simulated in some languages as tuples with tag first element. Discrete number of states, attaching information only relevant to each single state. Thus, never have invalid combination of other fields.
1 comments

I think in this context 'state' means 'state which changes over time', not necessarily the shape of the state at rest.

Turning it off and on again will fix mutable state, not poorly-typed state.