Request for review: std.net.isemail

Jonathan M Davis jmdavisProg at gmx.com
Wed Mar 23 10:09:30 PDT 2011


> On 2011-03-22 23:21, dsimcha wrote:
> > 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.
> 
> The helper functions are private, I just didn't think of that they would
> show up in the documentation.

Thanks to a bug, _all_ templated functions are public _regardless_ of what you 
mark them as (I recall a different bug report for it, but here's one: 
http://d.puremagic.com/issues/show_bug.cgi?id=2775 ). So, if you put 
documentation on private templated functions (be they directly templated or 
member functions of a templated type), you have to make sure that they aren't 
actually ddoc comments (so they start with /+ instead of /++ or /* instead of 
/**), otherwise, they end up in the documentation. Unfortunately, regardless 
of whether you document them, they could still be called in spite of the fact 
that they're supposed to be private, but one would hope that no one would do 
that. Hopefully the bug gets fixed at some point though.

- Jonathan M Davis


More information about the Digitalmars-d mailing list