Comment by deredede

Comment by deredede 21 hours ago

2 replies

> You need an email_or_error and a name_or_error, etc.

You don't need that. A practical solution is a generic `error` type that you return (with a special value for "no error") and `name` or `email` output arguments that only get set if there's no error.

mrkeen 9 hours ago

IOW return something for the caller to validate.

  • deredede 7 hours ago

    "Parse, don't validate" is a catchy way of saying "Instead of mixing data validation and data processing, ensure clean separation by first parsing 'input data' into 'valid data', and then only process 'valid data'".

    It doesn't mean you should completely eliminate `if` statements and error checking.