dfmt options

weaselcat via Digitalmars-d digitalmars-d at puremagic.com
Sun Mar 15 03:34:15 PDT 2015

On Sunday, 15 March 2015 at 09:10:13 UTC, Walter Bright wrote:
> On 3/15/2015 1:12 AM, Jonathan M Davis via Digitalmars-d wrote:
>> Which would instantly make it useless for many users, because 
>> many of them
>> will disagree with the "One True Way" regardless of what it 
>> is. Tabs vs
>> spaces, BSD Allman bracing vs K&R bracing, if(...) vs if 
>> (...), ( test1 &&
>> test2 ) vs (test1 && test2), etc., etc.
>> It's one thing to decide on a standard format that the 
>> official projects
>> would use. It's quite another to say that that's how all D 
>> programs in
>> existence should be, which is basically what we'd be doing if 
>> we made dfmt
>> only support one style. There's already quite a range in what 
>> folks do with
>> their D programs - be they personal or at companies which use 
>> D.
> A few years ago, I would have agreed with you. Today, I'm not 
> so sure:
>   https://golang.org/cmd/gofmt/
> Note the lack of configuration. Generally, it's been a big 
> success for Go.
> The advantages are:
> 1. People stop spending time bikeshedding over formatting. I've 
> read that gofmt users express relief over this.
> 2. After 40 years of programming, I certainly am tired of 
> formatting debates, and wish to spend my time on more 
> interesting things.
> 3. Straightforward incorporation of diverse code without having 
> to reformat them making git histories more difficult.
> > Let's _please_ not try and force any particular style on the
> D community.
> Forcing is a little strong. dfmt is an optional tool, not the 
> core language.

making the formatter customizable is a good thing, it will 
encourage people to work on phobos more because they can format 
it to their liking when working on it, then format it back to the 
`D-style` settings when committing. IIRC, Russel was just 
complaining about this a few days ago.

the default style should obviously be the D style.

More information about the Digitalmars-d mailing list