begin quoting Gabriel Sechan as of Wed, Jan 02, 2008 at 05:12:32PM -0600: > > > ---------------------------------------- > > Date: Wed, 2 Jan 2008 15:01:21 -0800 > > From: [EMAIL PROTECTED] > > To: [email protected] > > Subject: Re: Introducing Cobra > > > > On Wed, Jan 02, 2008 at 04:57:05PM -0600, Gabriel Sechan wrote: > > > >>The problem is that its much easier to get whitespace wrong than it is to > >>get braces wrong. For example- one of my most frequent refactors is > >>changing the nesting of a chunk of code- either moving it into a loop, > >>out of a loop, or into a new function. If you use braces, the code will > >>work, but may be indented in an ugly matter. If you do it with > >>whitespace, it will be broken. > > > > I would instead argue that this particular example is evidence of why > > indent-based blocking is a good thing, rather than bad. > > > > When I move a block of code in python, it is immediately obvious to me what > > kind of nesting change is needed. It is just a few keystrokes to shift the > > block to the right place. With braces, it is very easy to have them wrong, > > but get the indentation right. > > I have never in my life seen the indentation wrong but the braces > right.
I have. > I have seen the reverse, frequently. Sometimes, this too. I also *deliberately* muck up the indentation on a regular basis. > While you can put a brace in the wrong spot as a bug, you can do the > same with whitespace. You'll never get that type of error from just > moving code around. THis is absolutely a reason why indent based > blocking is a bad thing. I see a lot of "start with four spaces, indent a long way, come back to three spaces, indent a long way, come back to four spaces"... which is hard to see. > Indent based blocking is an attempt at solving a social problem > (people who don't indent, although I've never actually met one of > these people) Heh. I have. I've had the "let's talk about _why_ we indent" with several junior programmers. > with a technical solution (indentation as semanticly > meaningful). That just doesn't work- you're causing at least as many > problems as you're stopping (probably far more, because I've never met > a programmer who didn't indent predictably) and adding in whole new > classes of bugs. The correct answer is to educate the people who > don't indent. Yup. Because if they're not indenting, they've probably got other issues that they need to be educated about. [snip] -- I seem to have seen quite a lot of bad code Which is probably how I got in this grumpy mode Stewart Stremler -- [email protected] http://www.kernel-panic.org/cgi-bin/mailman/listinfo/kplug-lpsg
