dfmt
dfmt copied to clipboard
`version(){} else fun_declaration` shows weird braces
version (foo)
{
}
else
void main(string[] args)
{
}
@timotheecour how should it look like ?
shouldn't it be:
version (foo)
{
}
else
void main(string[] args)
{
}
for all functions, { should be at same indent as function start, shouldn't it?
well version is in the same league as #if
so
version (foo)
{
}
else
void main(string[] args)
{
}
would also be plausible
indeed, that seems even better.
Unfortunately this code too common, so it might make sense to special code it? This is my preferred formatting and I think the common one (even in Phobos/DMD) for cases where you want to negate a version like e.g.
version(unittest) {} else
void main()
{
import std.stdio;
writeln("Hello D");
}
DMD's style is a bit different (e.g. https://github.com/dlang/dmd/blob/master/src/dmd/libelf.d), but also do to having more than one case.