Indenting and alignment style

Richard A. O'Keefe ok at quintus.uucp
Thu Dec 8 07:58:06 AEST 1988


In article <4733 at mtgzz.att.com> avr at mtgzz.att.com (a.v.reed) writes:
> Objective readability (on which there
>is a vast literature in psychology, human factors and education
>journals) suggests that the optimal style would provide the reader with
>vertical alignment of the closing brace with the opening brace, and of
>immediately enclosed text with the enclosed braces, like this:
>
>	function(argument,argument)
>		{
>		statement;
>		statement;
>		}
>
Please cite a study which shows this.
In a language which uses keywords 'start' 'finish' instead of braces,
this is demonstrably silly:
	start
	if x > y ...
	while ...
	finish
lines the brackets up with the keywords of statements that have nothing
to do with them.  Surely it is clear that to avoid this kind of visual
confusion, the brackets must be elsewhere
	<opening bracket>
	<indent><statement>...
	<indent><statement>...
	<closing bracket>

The "comb" style as recommended for ADA works well in nearly every
language.



More information about the Comp.unix.wizards mailing list