Article View: comp.lang.postscript
Article #8927Re: indentation style
From: Glenn Reid
Date: Fri, 09 Feb 1990 05:51
Date: Fri, 09 Feb 1990 05:51
93 lines
4489 bytes
4489 bytes
In article <17880@rpp386.cactus.org> woody@rpp386.cactus.org (Woodrow Baker) writes:
>Glenn, don't take this personally, but....
>A particularly odious example is found on page 74 of the GREEN book.
Of course I'll take it personally. You called my indentation style
"odious".
Let me make a few points, because I think there are some things being
missed, then I'll shut up, for the greater good:
1. The opening brackets are not "lost", they are always at
the end of the line (with or without a trailing comment).
If the brackets ever had code following them, I would
agree with you.
% OK:
currentpoint pop 72 lt { %ifelse
showpage
}{ %else
0 0 moveto
} ifelse
% not OK:
currentpoint pop 72 lt { showpage
}{ 0 0
moveto
} ifelse
2. I'm not wedded to that indentation style, as I have
pointed out. It does, however, have a reasonable tradeoff
of readability versus code space, which is why I chose it
for the green book. It is also not odious or horrible nor
does it cause birth defects. It would behoove you to learn
to read it instead of complaining about it, because there
is a lot of it in the world.
3. Comments like %if help enormously to know what the open brace
is going to be closed by. You can call them "meaningless"
and "confusing to the issue", but when you have a lot of
nested braces and some of them cross pages, you simply
can't live without the comments.
4. You should look at the INDENTATION (read white space), not
at the curly braces. If you scan vertically down a column
until you something that is no longer at the same level
of indentation (white space), you can assume a sub-structure.
Scanning a little further, you'll see the closing brace,
and you'll know what the structure was. Seeing the open
brace doesn't tell you much anyway, unless there's a comment.
It's pretty easy, once you see it. The key point is NOT to
look at the curly braces, but to look at the white space.
5. Please don't include the entire text of an article when
you follow up. This is basic net etiquette. Please
subscribe to news.announce.newusers or whatever it's called.
6. I subscribe to the other technique with everything but {'s:
gsave
mydict begin
0 0 moveto
(test) show
end
grestore
What this boils down to, I guess is that you can't read my code very
easily. That's fine, but don't flame me for it. I can read yours.
How does this sound: "while Woody occasionally has something interesting
to say, I don't recommend following the style examples that he posts to
the net. While these are style issues, they have a much deeper impact.
One should program, not for oneself, but with the poor bugger who will
follow you in mind (or who will read your book)." You should recognize
those words, because they're yours. But this time, they're pointed back
at you.
>p.s. Once again, the comments are not directed at GLENN. They are directed
>at postscript programmers in general. The GREEN book just happend to be
>a handy spot to grab the examples from. I don't recommend following
>the style examples in the GREEN book, though otherwise the code is good.
OK, I'll bite. I DO recommend following the style examples in the GREEN
book. Take your pick.
There. I'm done taking it personally. Please realize that if you don't
want people to think you're sniping at them, you should be careful to just
provide information, rather than supplying opinions. You got better about
that on the indentation issue (when pressed by me) but it started out as
just "Folks, I don't like that style, so don't use it." People really
don't care who thinks what, they want to learn, and they learn by example,
and by ideas.
Glenn
Technical Details
Message-ID:
<135@heaven.COM>Path:
arc1-ca.pugleaf.net!utzoo!utgpu!jarvis.csri.toronto.edu!cs.utexas.edu!usc!elroy.jpl.nasa.gov!decwrl!adobe!heaven!glennReferences:
<17807@rpp386.cactus.org> <9002040147.AA16999@en.ecn.purdue.edu> <45829@wlbr.IMSD.CONTEL.COM> <17880@rpp386.cactus.org>Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!jarvis.csri.toronto.edu!cs.utexas.edu!usc!elroy.jpl.nasa.gov!decwrl!adobe!heaven!glenn From: glenn@heaven.woodside.ca.us (Glenn Reid) Newsgroups: comp.lang.postscript Subject: Re: indentation style Summary: you say potatoe, I say potatoe Message-ID: <135@heaven.COM> Date: 9 Feb 90 05:51:27 GMT References: <17807@rpp386.cactus.org> <9002040147.AA16999@en.ecn.purdue.edu> <45829@wlbr.IMSD.CONTEL.COM> <17880@rpp386.cactus.org> Reply-To: glenn@heaven.UUCP (Glenn Reid) Organization: Glenn Reid (at home), NeXT, Inc. Lines: 93