Path: utzoo!attcan!uunet!husc6!rutgers!mailrus!ames!elroy!jpl-devvax!lwall From: lwall@jpl-devvax.JPL.NASA.GOV (Larry Wall) Newsgroups: comp.unix.wizards Subject: Re: Indenting and alignment style Keywords: braces religion Message-ID: <3718@jpl-devvax.JPL.NASA.GOV> Date: 7 Dec 88 20:22:34 GMT References: <17680@adm.BRL.MIL> <1748@solo3.cs.vu.nl> <9063@smoke.BRL.MIL> <9076@smoke.BRL.MIL> <4733@mtgzz.att.com> Reply-To: lwall@jpl-devvax.JPL.NASA.GOV (Larry Wall) Organization: Jet Propulsion Laboratory, Pasadena, CA. Lines: 57 In article <4733@mtgzz.att.com> avr@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@jpl-devvax.jpl.nasa.gov