Style guide for indentation of template restrictions

Per Nordlöw per.nordlow at gmail.com
Sun Aug 23 09:10:19 UTC 2020


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


More information about the Digitalmars-d mailing list