> I believe that languages with typestate can cause types to change as a result of function calls
Do you have any specific languages?
Do you have any specific languages?
let x: u8;
I can't actually do anything with this variable: foo(x); // error
Except I can apply the initialization operator: x = 42;
And now I can do things with this variable as usual.But consider that the type of x hasn't changed as a result of the initialization. Beforehand it was a u8, and afterward it was still a u8, and yet something about the state of the variable changed my ability to use it in various contexts. I believe that typestate is something like this, generalized to allow variables to flow through states (like a compile-time state machine) to ensure that things happen in the correct order.