Re: tabs in source code

[prev] [thread] [next] [lurker] [Date index for 2006/06/24]

From: peter (Peter da Silva)
Subject: Re: tabs in source code
Date: 14:47 on 24 Jun 2006
pagaltzis@xxx.xx (A. Pagaltzis):
> I was with you up to "easier to read", but uh, where's the
> redundancy and documentation in that example?

It's easier to read because it contains redundant information that documents
the intent of the author better than a raw stream of tokens. That's the whole
point of indenting code at all (in sane languages, anyway).

Another example of layout as redundant documentation that might be easier:

	puts("<BLOCKQUOTE>");
	  put_escaped(quoted_text);
	  puts("<DIV ALIGN=RIGHT>");
	    puts("--");
	    put_escaped(attribution);
	  puts("</DIV>");
	puts("</BLOCKQUOTE>");

Or, layout coming to the aid of comments:

	/*	   name		type		variable	bound_var */
	add_symbol("height",	REAL,		TRUE,		&height);
	add_symbol("weight",	REAL,		TRUE,		&weight);
	add_symbol("buttons",	INTEGER,	TRUE,		&buttons);

In some languages you can bring named arguments to play, but it's still
worthwhile:

	add-symbol "height"	-type REAL	-variable	-bind height
	add-symbol "weight"	-type REAL	-variable	-bind weight
	add-symbol "buttons"	-type INTEGER	-variable	-bind buttons

> Not at all the same thing. Code layout and identifier names play
> in completely different leagues.

But they play the same sport. We're comparing College with Pro, not Rugby
with Cricket.

Generated at 20:01 on 27 Jun 2006 by mariachi 0.52