Learning D - first steps and best practices

qznc qznc at web.de
Wed Oct 2 01:38:10 PDT 2013


On Wednesday, 2 October 2013 at 03:28:59 UTC, Jonathan M Davis 
wrote:
> On Wednesday, October 02, 2013 03:19:19 Jesse Phillips wrote:
>> For me, if the program didn't format brackets on the same line 
>> I
>> wouldn't use it. If you start making things configurable, may 
>> as
>> well improve indent's support for D.
>
> Whereas I'd hate to have to write code that didn't have braces 
> on their own
> line. It's far better for us both to be able to write code the 
> way that we
> want than try and force standard formatting rules of some kind. 
> IMHO, they add
> little to no value and definitely make coding less enjoyable.

My vision: Jonathan checks out Jesses code to fix a bug. On 
opening the file his editor automatically reformats to 
braces-on-own-line. When committing the fix, a pre-commit hook 
reformats to the project-specific style braces-on-same-line. 
Everybody is happy. :)

Of course, there are edge cases, where automatic formatting 
should be broken. However, I think we should let them be and 
adapt. I also add code sometimes, just to remove a compiler 
warning like "unused argument". Likewise, I am fine with minor 
noise in exchange for consistent styling like described above.


More information about the Digitalmars-d-learn mailing list