A question of style

T. William Wells bill at twwells.com
Mon Dec 4 14:29:18 AEST 1989


In article <565 at s5.Morgan.COM> amull at Morgan.COM (Andrew P. Mullhaupt)
[presents his subjective judgements as relevant to the discussion.]

Sorry buddy, but your judgements are not mine. Moreoever, while
some of your conclusions are valid, basing them on subjective
judgements makes them appear less valid.

For example,

	"There are no good excuses for the comma operator because
	it masquerades as true concurrent assignment where it is a
	poor relation of it."

Maybe you think that the comma operator looks like concurrent
assignment. If so, you need to work harder at disentangling your
previous experience from your C programming. Many, perhaps most,
C programmers don't ever think of concurrent assignment when
seeing the comma operator. Certainly experienced C programmers
don't. You then go on to say:

	"The thing invites you to cram all sort of gooey side
	effects into for loops with increment and assignment
	operators."

Which is true, yet since you present it as related to that
subjective statement, you *weaken* the force of the statement.

Then you say (after a gratuitous and false ad hominem):

:                         Now with real concurrent assignment, you
: really can put your loop invariant maintenance in one place:
:
: (i++ , j--)
:
: can be replaced by the much more attractive:
:
: (i, j) := (i + 1, j - 1)

Yet again we have a very subjective judgement, one which I very
much disagree with. In fact, I'd say that the latter is defective
on more than one level. Besides the extraneous characters needed
to express a much simpler idea, you have interleaved two distinct
ideas, incrementing `i' and decrementing 'j'; this sort of thing
leads to decreased understanding.

On the other hand, you describe the swap operation, written as:

: (x, y) := (y, x)

which is, indeed, a good use of the idea of concurrent assignment.
There is one operation being expressed, so there is no burden on
the reader to disentangle several ideas from the single piece of
code.

The primary error that the comma operator leads to, when used in
the for statement, is the including of things which are not part
of the control structure itself, moving the controlled statements
into the for, and thus presenting the reader with several ideas
crammed into the one statement.

---
Bill                    { uunet | novavax | ankh | sunvice } !twwells!bill
bill at twwells.com



More information about the Comp.lang.c mailing list