[OT] Auto code reformating / one coding style enforcment.
Dawid Ciężarkiewicz
dawid.ciezarkiewicz at gmail.com
Sat Aug 12 13:54:36 PDT 2006
This is *not* proposition of D change. Only free concept that I wish to
share with D users.
Most of the time of my coding work I'm dealing with code that I didn't
wrote. What is most irritating is when I just can't reformat code using
indent or astyle because I need to work on little change and produce diff
that will fit into original repository. And sometimes code is completely
mess - I don't care if someone likes breaking brackets here and there,
but ... I thing you all know what I'm talking about.
My thoughts are always like this: why creators of C language allowed people
to format code freely? Wouldn't world be a better place if languages would
enforce their one-true-coding-style? If there would be no choice there
would be no reason to argue.
"If I'd write my own language ..." (don't get it too serious - it's only
hypothetical ;-) ) there would be no way to code same code in two different
ways (except of identifier names, comments and such ...). There would be
one standard and compiler would enforce it - throwing errors about code
formating or even reformat code in the fly if asked to (optional switch or
something like that).
The users would have to adopt to code in such language - get used to one
coding style, which probably wouldn't be what they were doing before in
every aspect, but ...
... after some time they would discover that when they look at someone else
code in that language - there is no difference. Working with patch/diff
tools is nicer, reading code pleasure is bigger. Everything is better ...
Python code tries to enforce coding style rules - I like that aspect of it.
What I don't like is not enforcing to use tabs for indentation and which is
even worse - not enforcing on _any_ standard about indentation, only to be
consistent in whole source file. Except that I'm not aware of any language
(except Whitespace ;-) ) that do something similar. Have anybody even
tried? Did such language succeed?
What do you think?
More information about the Digitalmars-d
mailing list