Thread overview | |||||
---|---|---|---|---|---|
|
August 22, 2020 Style guide for indentation of template restrictions | ||||
---|---|---|---|---|
| ||||
Is there code convention for the indentation of template restrictions? Should a restriction be indented as void f(U)(U a, ref U b) if (isUnsigned!U) or not as in void f(U)(U a, ref U b) if (isUnsigned!U) ? |
August 22, 2020 Re: Style guide for indentation of template restrictions | ||||
---|---|---|---|---|
| ||||
Posted in reply to Per Nordlöw | On Saturday, 22 August 2020 at 20:26:40 UTC, Per Nordlöw wrote: > Is there code convention for the indentation of template restrictions? > > Should a restriction be indented as > > void f(U)(U a, ref U b) > if (isUnsigned!U) > > or not as in > > void f(U)(U a, ref U b) > if (isUnsigned!U) > > ? The D Style suggests the latter, see https://dlang.org/dstyle.html#phobos_declarations |
August 23, 2020 Re: Style guide for indentation of template restrictions | ||||
---|---|---|---|---|
| ||||
Posted in reply to MoonlightSentinel | On Saturday, 22 August 2020 at 22:15:04 UTC, MoonlightSentinel wrote: > On Saturday, 22 August 2020 at 20:26:40 UTC, Per Nordlöw wrote: >> Is there code convention for the indentation of template restrictions? >> >> Should a restriction be indented as >> >> void f(U)(U a, ref U b) >> if (isUnsigned!U) >> >> or not as in >> >> void f(U)(U a, ref U b) >> if (isUnsigned!U) >> >> ? > > The D Style suggests the latter, see https://dlang.org/dstyle.html#phobos_declarations If so, dfmt's `dfmt_template_constraint_style` [1] should default to conditional_newline or always_newline instead of conditional_newline_indent [1] https://github.com/dlang-community/dfmt#dfmt-specific-properties |
Copyright © 1999-2021 by the D Language Foundation