Re:Parse, Don't Validate (2019)
by gnulinux on Tuesday March 07, 2023 @03:19PM
(#35060605)
You're misunderstanding. Validation looks like
whereas parse looks like:
There is no problem using `ValidEmail` abstraction. The problem is type stability, when your program enters a stronger state at runtime (i.e. certain validations are performed at runtime) it's best to enter a strong state at compile time (stronger types) so that compiler can verify these conditions. If you remain at String, these validations (that a string is valid email) have no compile-time counterpart so there is no way for compiler to verify. So use `ValidEmail` instead.
[ Parent
| on HN ]
There are no comments on this comment yet.