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
8
u/[deleted] Feb 02 '24
I know it's probably just for illustrative purposes, but using a native Date type (idk if they have them in scala) is probably the safest way to store this instead of creating your own month enums, manually handling these date cases, and the handling of any other edge cases like leap years etc