Indenting and alignment style

Richard A. O'Keefe ok at quintus.uucp
Mon Dec 12 18:27:33 AEST 1988


In article <4745 at mtgzz.att.com> avr at mtgzz.att.com (a.v.reed) writes:
>In article <823 at quintus.UUCP>, ok at quintus.uucp (Richard A. O'Keefe) writes:
>> In article <4733 at mtgzz.att.com> avr at mtgzz.att.com (a.v.reed) writes:
>> > Objective readability 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.

>There were 3 empirical assertions in my argument on this:

>1. Comprehension of computer programs is enhanced by cues for matching
>each closing delimiter with the corresponding opening delimiter.

Agreed.

>2. Comprehension of computer programs is enhanced by cues for matching
>enclosed statements with the enclosing scope delimiters.

"matching" -- no way!  "associating" -- of course.

>3. Vertical alignment is an effective matching cue for one-character
>delimiters.

Agreed.

However, from *NONE* of these three points can the claim I have underlined
be deduced.  The statement (which I accept, of course!) that vertical
alignment is an effective way of associating things tells us that the
statements, not being at the same syntactic or conceptual level as the
brackets, would benefit from being indented.  Hence the old Algol 60
convention:
	if <condition> then
	   begin
	      <decls>;
	      <stmts>
	   end
	else
	   begin
	      <decls>;
	      <stmts>
	   end

Let me make my request clearer.  Can anyone cite a study which shows
	if (...)
	    {
	    <stmt>
	    <stmt>
	    }
to be superior to
	if (...)
	  {
	    <stmt>
	    <stmt>
	  }



More information about the Comp.unix.wizards mailing list