dfmt options

Jacob Carlborg via Digitalmars-d digitalmars-d at puremagic.com
Mon Mar 23 00:59:20 PDT 2015


On 2015-03-22 18:05, Martin Nowak wrote:

> Sorry haven't read the whole thread.
> I think there should be an option (even default on) to allow small
> single line functions.
>
> This can sometimes be fairly annoying. For example when writing range
> adapters, see
> https://github.com/D-Programming-Language/phobos/blob/77152b537b4cc6482d6181c17866475f1115beb9/std/range/package.d#L216.
>
> bool empty() { return arr.length == 0; }
> T opIndex(size_t i) { return arr[idx]; }
> T front() { return arr[0]; }
> void popFront() { arr = arr[1 .. $]; }

I really don't like this way of formatting code. Although I would like 
that the D syntax allowed to drop the curly braces, like with 
if-satements. That would result in much nicer one-liner functions.

-- 
/Jacob Carlborg


More information about the Digitalmars-d mailing list