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.

And if you mention auto-indent tools in editors-  if you need an editor to
have a certain feature to avoid a common bug, you have a language flaw.

This isn't an auto-indent thing, just shifting a block of code to the left
or right.  Auto-indent isn't really very useful in something like Python,
since the auto-indenter will be based off of the syntax.  Since the
indentation is the syntax, you just have to tell the editor what to do.

Dave

--
[email protected]
http://www.kernel-panic.org/cgi-bin/mailman/listinfo/kplug-lpsg

Reply via email to