|
|
|
|
|
by edflsafoiewq
867 days ago
|
|
You can use new types with validation too. In fact the approaches seem to be duals. Parse, don't validate: string ParsedString
untrusted source -------> parse --------------> rest of system
Validate, don't parse: UnvalidatedString string
untrusted source ------------------> validate -------> rest of system
|
|
If you default to treating primitive types as untrusted, it's hard for someone to accidentally convert an untrusted type to a trusted type without using the correct parse method.