Is anyone working on a D source code formatting tool?

Russel Winder via Digitalmars-d digitalmars-d at puremagic.com
Mon Jan 12 01:57:37 PST 2015


On Sun, 2015-01-11 at 11:19 -0800, Walter Bright via Digitalmars-d wrote:
> 
[…]
> It would be in the DMD front end, so LDC and GDC would it 
> automatically.

s/it/get it/ ?

What wouldn't be automatic would be the command line options and other 
surrounding bits and pieces.
> 
[…]
> The rules are always going to be wrong. But in this case, that's ok.

For someone, not everyone. For some the rules will be right or at 
least acceptable.
> 
[…]
> Sometimes it's better to just conform.

It depends if the grievances are small enough to ignore and/or the 
benefits outweight. Sometimes conformance is a "bridge too far" and 
non-use, or use of an alternative is the right course of action.

> 
[…]
> Really? Like what? After many years of arguing about formatting 
> myself, I
> decided that I had better things to waste my time on.

I do not see a point in opening up the debate. An official style 
exists, it is that which is required for Phobos. This is the style 
that will be implemented by dfmt.

[…]

> 
> So you decided to conform rather than not use Go.

Yes. My grievances against the enforced style are not sufficient to 
abandon, and the need to deal with error codes at all times is not a 
sufficient pain to stop me using Go. What is the counterbalance? Go 
routines, the use of channels, and the eshewing of any form of shared 
mutable memory. Go has a lot of crap, a lot of positive and negative 
hype, and dataflow built into the language. I find it surprising easy 
to ignore the crap.

> (Anyhow, I suggest that gofmt is only mandatory if you wish to 
> contribute to
> offical Go code, not for your own projects.)

I suspect applying gofmt to Phobos code would have interesting results 
;-)

PEP-8 allows for some minor variations. It can be applied as is for 
official PEP-8 compliant code or you can have variation. Of course the 
pep8 code is only an advisor, gofmt rewrites your code. Originally the 
gc compiler automatically rewrote your code,  but that was seen as too 
fascist, so gofmt was split off as a separate tool. Now though 
everyone uses gofmt anyway adhering to the "one true style". Having 
gofmt separate is though still the right thing as there is gc and 
gccgo which share no code.

-- 
Russel.
=============================================================================
Dr Russel Winder      t: +44 20 7585 2200   voip: sip:russel.winder at ekiga.net
41 Buckmaster Road    m: +44 7770 465 077   xmpp: russel at winder.org.uk
London SW11 1EN, UK   w: www.russel.org.uk  skype: russel_winder



More information about the Digitalmars-d mailing list