try/catch idiom in std.datetime
John Colvin
john.loughran.colvin at gmail.com
Tue Nov 19 11:03:03 PST 2013
On Tuesday, 19 November 2013 at 18:29:57 UTC, Andrei Alexandrescu
wrote:
> I'll allow myself a piece of advice - the density of e.g.
> https://github.com/jacob-carlborg/dstep/blob/master/dstep/translator/Translator.d#L251
> is low enough to make it career limiting.
Doesn't look *that* sparse to me... I think the 8-space
indentation give a false perspective. E.g. this is actually 1
line longer, but looks denser:
package string translateFunction (string result, string name,
Parameter[] parameters, bool variadic, String context)
{
context ~= result ~ ' ' ~ name ~ " (";
string[] params;
params.reserve(parameters.length);
foreach (param ; parameters)
{
string p;
version(D1)
{
p ~= param.type;
}
else
{
if (param.isConst)
{
p ~= "const(" ~ param.type; ~ ')';
}
else
{
p ~= param.type;
}
}
if (param.name.any)
{
p ~= " " ~ translateIdentifier(param.name);
}
params ~= p;
}
if (variadic)
{
params ~= "...";
}
context ~= params.join(", ") ~ ')';
return context.data;
}
More information about the Digitalmars-d
mailing list