[phobos] isemail error handling

Andrei Alexandrescu andrei at erdani.com
Sat Mar 5 05:44:21 PST 2011


Make the status code an enum.

Andrei

On 3/5/11 5:07 AM, Jacob Carlborg wrote:
> The PHP version returns "true", "false" or a code indicating why the email address isn't valid. In addition to that it has an out parameter, an array, containing among other things the local and the domain part of the address. I was thinking that I either keep it like that, with an out parameter, or return a struct with the information.
>
> If I return a struct I was thinking it would contain the following fields:
>
> bool valid;
> string local;
> string domain;
> int statusCode/reasonCode;
>
> And also make the struct implicitly convertible to bool. Would that be too much to return by value?
>


More information about the phobos mailing list