Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

> There's no good way to prevent a user from creating the record with an invalid date

That is factually incorrect.

You can do all of that validation in a record constructor, much like in a normal Java class constructor. There's a difference in syntax: you don't need to repeat the constructor arguments in parantheses, and don't have to perform the assignments yourself. These are tailored specifically for easy validation.



Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: