Path: utzoo!utgpu!jarvis.csri.toronto.edu!cs.utexas.edu!uwm.edu!zaphod.mps.ohio-state.edu!mips!apple!voder!wlbr!awds26!mh From: mh@awds26.eaton.com (Mike Hoegeman) Newsgroups: comp.lang.postscript Subject: Re: indentation style Message-ID: <45829@wlbr.IMSD.CONTEL.COM> Date: 6 Feb 90 19:26:22 GMT References: <17807@rpp386.cactus.org> <9002040147.AA16999@en.ecn.purdue.edu> <133@heaven.COM> <17872@rpp386.cactus.org> Sender: news@wlbr.IMSD.CONTEL.COM Reply-To: mh@awds26.UUCP (Mike Hoegeman) Organization: Contel FSD, Westlake Village, CA Lines: 76 I've written a fair amount of postscript (of the NeWS flavor) so just thought I'd put in my two cents worth here. In article <17872@rpp386.cactus.org> woody@rpp386.cactus.org (Woodrow Baker) writes: >> > However, I don't >> >recommend following his brace style, as it is a bit hard to read. >> >> >> /stuff { %def >> sdfasdfasdff >> a sdfasdfasdf >> } def > >This has 2 problems. The first is that you have to hunt for the opening >curly brace. When you are several levels deep in nesting, and don't have an >editor that matches braces, it is exasperating. The second problem >involves the comment. It is to easy to overlook. You follow the Indian Hill >'C' style, which I totaly disagree with, as being hard to read. >I like to be able to see the procedure names at a glance, with the code >clearly lined up under a brace, and the procedure name hanging off by it's >self. >a In theory, I agree with you on the above comment. However in practice I'd have to side with Glenn on not putting the brace on it's own line. I started out putting opening braces on their own line but when i started writing large chunks of code it seems to balloon into nothing but a bunch of lines with braces and a few lines of code in between. > >> % sample 2 (which yours should have been): >> >> /stuff >> { >> asdfasdfasdf >> asfasfasdfasf >> } def > >Not quite: >it should have been > /stuff > { > asdfasd > sadsdfgg > } def Why is this better than % sample 2 above ?? (now don't get hostile this is a genuine question :-) ) To me the style directly above very much confuses ... - what exactly the contents of the executable array are (i.e. the braces are harder to pick out) - what is being done with it. once you pick out with your eyes the executable array contents (OK, function body) you've been distracted enough that you have to scan back and remember , Oh yeah the /stuff that was standing out there by itself must be the name that is getting bound to this function. It's not all that bad with a simple function declaration but with lots of ifelse's and case statements and whatnot it's yuck-o. I'll stop now since i'm probably getting quite incoherent. p.s. there is an indent type program that was posted a while back to comp.windows.news that does a really good job fixing up ungodly PostScript it can be configured a couple different ways depending on your tastes. if there is interest I'll repost it (or a t least direct you to how to get it) -mike.