[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Code formatter

From: Chris Snyder
Subject: Re: Code formatter
Date: Fri, 13 Nov 2009 10:44:54 -0500
User-agent: Thunderbird (X11/20090817)

Graham Percival wrote:
1) running astyle will change lines of code.  This makes the
history harder to look at... if we want to know who wrote a
particular line (say, "there seems to be a bug here; hey Joe, why
did you write "if (x = 3)" ?"), then it will appear that *you*
were the last person to change that line of code.  Even if all you
did was run astyle on it.

That seems to me to be unavoidable - or at least not worth the cost (investigating whitespace-aware diff tools, etc.) of avoiding it. Since the commit message would be "Automated formatting cleanup" we would just go to the previous commit in the tree (looking back on the Frogs list discussion, I see that you suggested exactly that).

2) many programmers view code style in a highly personal,
quasi-religious manner.
...Han-Wen and Jan have different views...

If the standard isn't even completely defined then how could the job of code janitor be given to an inexperienced Frog? It seems to me that no one can solve this problem until an official LilyPond coding standard is fully set in stone. In the meantime, newbies are left wondering what code style they should adhere to (perhaps having to predict which dev will be looking at a particular patch).

Any automatic tool will probably result in everybody having to
give up at least one closely-held belief (whether it's the
supremacy of tabs, or lining arguments up after an opening brace,
or how a switch/case command looks, or whatever).  So when you
propose a tool, we need to know what it will change.  And for all
those changes, we need to be convinced that it's an ok change.

I'm going to "come out of the closet" here, in a manner - I'm primarily a Java programmer. I don't think I can count on both hands the number of personal formatting preferences (not to mention an intense dislike of C++ - but I'm not about to touch *that* dead horse) I've suspended in order to contribute. I'm not complaining about this - as a newcomer, it's my duty to adhere to established standards - but I'd like to know what the standards are.

Sometimes, the automatic tool will just make existing
badly-formatted code meet our own standards.  In other cases, it
*will* change the standards.  Some of us won't care; others will
care deeply.

I know I'm not in a position to credibly admonish those that have put countless hours into what's essentially a labor of love, but it seems to me that these personal holy wars often get in the way of real productivity (the amount of time you've expended responding to me, for instance). It looks to me that 99% of the coding style is agreed upon - is the 1% really worth all of this frustration?

How about a compromise for tabs vs. spaces: even lines use spaces, odd lines use tabs. I'm sure we could create an emacs rule for that.

(since you don't know me very well, let me assure you that the former paragraph was written with tongue firmly implanted in cheek)

Thanks, and sorry for taking up everyone's time.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]