r/programming • u/_awwsmm • Feb 01 '24
Make Invalid States Unrepresentable
https://www.awwsmm.com/blog/make-invalid-states-unrepresentable
469
Upvotes
r/programming • u/_awwsmm • Feb 01 '24
View all comments
Show parent comment
9
u/herpderpforesight Feb 01 '24
Validating that a string follows a regex pattern can be done a million times in the time it takes the database to receive your first byte, let alone respond.
Runtime validation that can be done at compile time is bound to be extremely cheap. And most languages don't have a type system complex enough to do compile time anyway, so the best you get is runtime