Path: utzoo!attcan!uunet!seismo!sundc!pitstop!sun!decwrl!decvax!ima!cfisun!lakart!dg From: dg@lakart.UUCP (David Goodenough) Newsgroups: comp.lang.misc Subject: Re: Indentation for parsing (was Re: Block Closure (was Re: FOR loops)) Message-ID: <94@lakart.UUCP> Date: 6 May 88 18:22:33 GMT References: <4625@ihlpf.ATT.COM> Organization: Lake - The systems people Lines: 46 From article <4625@ihlpf.ATT.COM>, by nevin1@ihlpf.ATT.COM (00704a-Liber): > In article <5992@utcsri.UUCP> norvell@utcsri.UUCP (Theodore Stevens Norvell) writes: >>The discussion about using indentation to indicate program structure is >>interesting to me as I have designed a language which does exactly this >>and written a compiler for it. ..... > > This kind of stuff is better enforced by language-sensitive editors and > pretty-printers, not compilers. ..... And then there's always OCCAM > ..... And without > language-sensitive editors and/or pretty-printers, it is very hard always > getting the indentation right. This last comment almost deserves a flame. What is needed to produce correctly indented source code with any editor (be it vi, VEDIT or whatever) is *_DISCIPLINE_*. In 1980 at university, I decided on a coding style: if (test) { statement; statement; for (xyz; abc; foo) statement; } And I stick to it militantly - 8 years worth of it. It is now so ingrained that I do it as a reflex. ALWAYS produces readable code, and I can do a 'egrep "[{}]" \!*' to look for lines that contain {s and }s, and spot mismatced {}s in a twinkle. This is one of my objections to the other style: if (test) { statement; ..... It is too easy to mismatch, as you have to hunt for the { I've got my asbestos suit ready for the inevitable flames :-) :-) :-) -- dg@lakart.UUCP - David Goodenough +---+ | +-+-+ ....... !harvard!adelie!cfisun!lakart!dg +-+-+ | +---+