← Back to context

Comment by chii

2 years ago

> It wasn't, that's exactly what you did

the thing with using types to make unrepresentable state is that it ensures the compiler is the one checking.

By doing it "manually" this way, you're not saving much effort. You still had to make the analysis of which state is valid, and to code it up (hopefully without a mistake). The state of the program can also temporarily be invalid - just happens to fast for the user to notice (thus "fixing" the bug).

It's probably the best that could've been done other than a rewrite, but make no mistake - it's not the ideal.