[phobos] phobos commit, revision 1851
andrei at erdani.com
Sat Aug 14 10:25:40 PDT 2010
Great work! A few nits:
* Generally the prevalent Phobos (and I hope D) style is to declare
local values as late as possible. This is pretty much ubiquitous in
today's style guides for all languages (Code Complete, C++ Coding
Standards etc.) Even C99 caved in and allows declarations intermixed
* In D, use of auto is recommended unless you want to make a specific
point by mentioning the type. So, a suggested rewrite:
h = sock.gethostbyname(std.string.toStringz(host));
auto h = sock.gethostbyname(std.string.toStringz(host));
// Define addr upon first use
* The pattern if (cond) throw new X(args) is best encoded with enforce:
if(h is null)
throw new StdioException("gethostbyname");
enforce(h !is null, new StdioException("gethostbyname"));
enforce() has a special overload that detects the presence of a
Throwable in the second position and does what it should do.
* Phobos currently uses full bracing after if, while etc. I've tried to
follow that but on occasion I slip. I'm not sure whether we should
enforce such rules; this might be a good time to discuss that.
* Generally I encourage economy of vertical space, e.g.
auto imp = new File.Impl(fp, 1, host ~ ":" ~ to!string(port));
f.p = imp;
f.p = new File.Impl(fp, 1, host ~ ":" ~ to!string(port));
This is an awesome development. I'll play with the code today.
On 08/14/2010 12:12 PM, dsource.org wrote:
> phobos commit, revision 1851
> user: adr
> commiting my first attempt at network support in the File interface.
> phobos mailing list
> phobos at puremagic.com
More information about the phobos