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

Re: Tabs v.s. spaces (was Re: Programming first steps.)



On Mon, Nov 17, 2003 at 05:21:23PM -0800, Steve Lamb wrote:
> H. S. Teoh wrote:
> >On Mon, Nov 17, 2003 at 11:47:34AM -0600, Chad Walstrom wrote:
> >[snip]
> 
> >>I have a love-hate relationship with the significant whitespace.
> 
> >I have a hate-hate relationship with it. I much prefer free-style syntax
> >where the programmer is allowed to use his best judgment on how to indent
> >the code. Of course, in less-than-ideal projects, or projects with
> >less-then-ideal programmers, this could result in a mess, but I'm speaking
> >of personal preference here.
> 
>     Problem is that in languages which allow "free-style syntax" you're not 
> allowed free-style syntax at all.  You're required to match }'s with {'s 
> (or the local language equivolents) and end all lines with ; (except for 
> some cases when you don't have to).  This is still a restriction of the 
> same order, just with different characters and rules.
> 
>     Oddly enough ever since picking up Python a few years back I've never 
> once felt constrained by its significant whitespace.  I felt a profound 

Significant whitespace?  Shudder, that brings back crusty old memories 
of Fortran.  I have great fondness for fortran because of the wonderful 
mathematical algorithms in LinPack, but I have no fondness for 
significant whitespace.

> relief, however, when dealing with other people's code becuase it looked 
> and behaved just like mine.  There is enough freedom in the rules that a 
> programmer doesn't have to worry about the end of the screen yet there is 
> enough sensible structure to make the code readable.  I mean, let's get 
> down to it....
> 
> if foo {
>     bar;
> } else {
>     baz;
> }
> 
> if foo
> {
>     bar;
> }
> else
> {
>     baz;
> }
> 
> if foo {
>     bar;
> }
> else {
>     baz;
> }
> 
> ....if you remove the points of contention between those three you're left 
> with...
> 
> if foo
>     bar
> else
>     baz
> 
> ...which is a colon away from legal Python syntax.  :P
> 
> -- 
>          Steve C. Lamb         | I'm your priest, I'm your shrink, I'm your
>        PGP Key: 8B6E99C5       | main connection to the switchboard of 
>        souls.
> -------------------------------+---------------------------------------------




Reply to: