Newsgroups: | comp.compilers |
From: | stidev@gate.net (Solution Technology) |
Keywords: | syntax, design |
Organization: | Compilers Central |
References: | 95-04-013 95-05-011 |
Date: | Fri, 12 May 1995 11:09:21 GMT |
J.C.Highfield@loughborough.ac.uk wrote:
: Using indentation instead of block start and finish markers
: seems to cut down the amount of incorrectly structured program
: particularly for novices, but all that indentation can make the
: programs very hard to read on a small screen unless you have some
: technique of handling the extreme program 'width'. Printing out
: the program also suffers these problems.
: Occam programming systems usually get around this with folding
: editors, where a 'fold' contains code which inherits the indentation
: of the fold. When you enter a fold you see the code it contains
: starting in column 1. This is works OK for programming. However, I
: have never seen a good solution for printing out these programs. You
: either print them out as a 'flat' file, where all the folds are
: expanded and so the text runs off the right side of the page (or
: wraps around) or you use a fancy fold-aware listing program that
: prints out the contents of the folds after the code containing them -
: equivalent in some ways to printing functions after the code that
: calls them but in my experience much harder to read.
I found style of programming can affect the amount of indentation.
I actually try to limit the amount of nesting so that I don't indent
across the page. If it is getting that deep maybe there should be
another class to handle the details. I also use what I call chained ifs.
that correspond to "case/switch" statements.
if ...
statements
else if ...
statements
else if ...
statements
else
statements
This minimizes the amount of indentation by considering it as one control
structure.
Ken Walter
--
Return to the
comp.compilers page.
Search the
comp.compilers archives again.