[wplug] Indenting to control block structure [was: RE: first language]

Dave Neuer mr_fred_smoothie at yahoo.com
Tue Apr 1 19:22:53 EST 2003


The thing that's always bothered me about languages
which attach syntatic significance to whitespace is
purely theoretical: what happens when you have a large
team of programmers working on the same source files
w/ different editors, perhaps on different platforms,
and differences in formatting which aren't visually
apparent occur?

For instance, on Unix a tab is 8 spaces. What if
someone else on a different platform edits the same
file (and say for the sake of argument that their
platform uses a width of 4 spaces to indent tab
characters and their own editor preference is set to
indent by 4 space characters -- not a tab).

What happens when someone goes to execute this code?
Will the interpreter bail because one line starts w/ a
tab and the other 4 spaces? How will person #2 fix the
error when they can't visually recognize the cause?

The nice thing about braces (or any other
non-whitespace delimiter like parens) is they are
*visually* unambiguous. Whitespace is *visually*
ambigous.

For people programming alone it's obviously not an
issue (and like I said I'm not sure it's even ever
practically been an issue for teams).

Dave

--- Tom Moertel <tom at moertel.com> wrote:
> On Tue, 2003-04-01 at 11:21, Weber, Larry A wrote:
> 
> > I can't tolerate a language that is whitespace
> dependent.  Python uses
> > indentation instead of brackets.
> 
> Don't knock it until you have spent a few months
> using it.
> 
> I'm a big fan of the Haskell programming language,
> which lets you use
> either layout (indentation) or brackets to define
> logical blocks.  After
> a few months of coding in Haskell, I now use
> layout-based blocks almost
> exclusively.  I've tried it both ways, and for me
> the choice is
> obvious.  Layout-based blocks improve the S/N ratio,
> eliminate clutter
> and redundancy, and give programmers better control
> over vertical white
> space, which when used wisely makes code more
> understandable.
> 
> In fact, I like layout-based blocks so well, I
> brought them to Perl:
> 
>    
> http://www.kuro5hin.org/story/2003/3/18/235625/457
> 
> So, don't write them off until you have given them a
> good, long try. 
> You might discover that you have been missing
> something good.
> 
> Cheers,
> Tom
> 
> 
> _______________________________________________
> wplug mailing list
> wplug at wplug.org
> http://www.wplug.org/mailman/listinfo/wplug


__________________________________________________
Do you Yahoo!?
Yahoo! Tax Center - File online, calculators, forms, and more
http://platinum.yahoo.com



More information about the wplug mailing list