Request for review: std.net.isemail

dsimcha dsimcha at yahoo.com
Tue Mar 22 15:21:30 PDT 2011


On 3/22/2011 6:04 PM, Jacob Carlborg wrote:
> I've now finished the port of Dominic Sayers' PHP is_email function
> (http://www.dominicsayers.com/isemail) and sending it for review.
>
> A few comments:
>
> * Due to limitations in std.regex some unit tests fail and are out
> commented
>
> * Due to some bugs (4673, 5744) in Phobos this module contains private
> functions with fixes for these bugs
>
> * The DNS check is not implemented resulting in a few out commented unit
> tests
>
> Github: https://github.com/jacob-carlborg/phobos/tree/isemail
> Documentation: http://dl.dropbox.com/u/18386187/isemail.html
>

I haven't reviewed the implementation and don't plan to because I don't 
know enough about what issues might arise with something like this to 
provide good feedback.

My major comment about the API is that helper functions like 
firstChar(), max(), substr(), compareFirstN(), grep() and get() should 
be made private and not included in documentation.  If you think they 
might be generally useful, they can be made public and documented once 
we figure out where they belong.  They definitely don't belong in the 
API of a module for email address validation, though.

Also a few questions regarding status codes:  It looks like the status 
codes are not mutually exclusive.

1.  How are multiple errors handled?  Are the status codes or'd?  Is one 
returned arbitrarily?

2.  Does the multiple status codes issue matter for real use cases?

3.  What are EmailStatusCode.On and EmailStatusCode.Off?


Other than that, it looks pretty good to me.  It solves a simple (at the 
conceptual level if not the implementation level) problem with a simple API.


More information about the Digitalmars-d mailing list