Indenting and alignment style

Larry Wall lwall at jpl-devvax.JPL.NASA.GOV
Thu Dec 8 06:22:34 AEST 1988


In article <4733 at mtgzz.att.com> avr at mtgzz.att.com (a.v.reed) writes:
: 
: 	function(argument,argument){
: 		statement;
: 		statement;
: 	}
: 
: With this style, the reader cannot use vertical alignment for conceptual
: matching, either between the corresponding opening and closing brace, or
: between the braces and the text they enclose.

You can call it "overlearned skills" or whatever, but when I see a
closing brace I don't WANT to find the opening brace--I want to find
out what the predicate controlling the block is.  I just want to look
straight up and see the function, or the "if", or the "for", or whatever.

There may be a large body of psychohysterics that proves that vertical
alignment of braces with enclosed statements enhances syntactic
understanding, but productivity arises from *semantic* understanding.
Let the compiler check the syntax.

There will always be a fight between the "combers" and the "danglers",
I fear.  Each side can muster "objective" proof.  (There can be little
or no objective proof of what works better for experts, actually,
because experts are ineligible for experiments that require "naive"
subjects.  But naive subjects aren't going to have the same goals as
experts.)

: The solution, I think, is to write code in the style that's best for
: you, and use "prettyprinting" tools when reading or editing code written
: in a different style by somebody else. That way, new programmers can
: learn the (objectively optimal) vertically aligned style without unduly
: inconveniencing the "old dogs" and traditionalists. After all, *tools*
: are why we use UNIX(R) and C in the first place. Insisting that everyone
: conform to what you happen to like and/or are used to isn't just
: religion, it is neanderthal religion. It'll make you miserable. So just
: filter the code you read through the prettyprinter of your choice, and
: be happy. OK?

A nice happy world-peaceish thought, but it's not that simple.  If I
prettyprint somebody else's program, I can no longer generate patches
that are easy to apply to the original code.  Nor can I easily apply
patches that the originator sends out.  For better or for worse, the
"real" code needs to remain in the original format.  (You could
conceivable prettyprint a copy just for perusing, but few people are
going to take the trouble.)

Maybe neanderthal religion is the best we can do.  It's overstating
things, however, to say that this must make me miserable.  A bit grim,
but not miserable.

Combers
    of the world
Unite!						:-)

Larry Wall
lwall at jpl-devvax.jpl.nasa.gov



More information about the Comp.unix.wizards mailing list