News for hackers. Stuff that matters.
Re:Parse, Don't Validate (2019) by JambalayaJimbo on Tuesday February 10, 2026 @11:52AM (#46962743)
If you are not checking that the phone number is 10 digits (or whatever the rules are for the phone number for your use case), it is absolutely pointless. But why would you not?
Re:Parse, Don't Validate (2019) by jghn on Tuesday February 10, 2026 @12:06PM (#46963029)
I would argue it's the other way around. If I take a string I believe to be a phone number and wrap it in a `PhoneNumber` type, and then later I try to pass it in as the wrong argument to a function like say I get order of name & phone number reversed, it'll complain. Whereas if both name & phone number are strings, it won't complain.

That's what I see as the primary value to this sort of typing. Enforcing the invariants is a separate matter.