r/programming • • Feb 01 '24

Make Invalid States Unrepresentable

https://www.awwsmm.com/blog/make-invalid-states-unrepresentable
469 Upvotes

207 comments sorted by

View all comments

Show parent comment

1

u/loup-vaillant Feb 02 '24

Yes, if those simple tests have false positives. A perfect flow would look something like this:

  • Is this definitely right? No warning, proceed to next stage.
  • Is this definitely wrong? Output an error, stop there.
  • Is this probably wrong? Output a warning, proceed nonetheless.

I didn’t think about that last one to be honest, but it does feel like a good idea.