[580] in Coldmud discussion meeting
use of test value in a while loop
daemon@ATHENA.MIT.EDU (Fri Nov 11 20:15:10 1994
)
From: deforest@netcom.com (Robert de Forest)
To: coldstuff@MIT.EDU
Date: Fri, 11 Nov 1994 17:14:27 -0800 (PST)
There has been a raging debate on this list on the following uglyness:
@program thing.example
var test_val;
test_val = .test();
while (test_val) {
.use_of_test_val(test_val);
test_val = .test();
}
.
A wise programmer just gave me a clue. He said the above could be re-written
in the following way:
@program thing.loop_code
arg test_val;
test_val && .use_of_test_val(test_val);
return test_val;
.
@program thing.example
while (.loop_code(.test()));
.
It costs a method call and gives you an abstraction and simplification. With
.loop_code marked private/local/"search for method on definer() only", would
not be too expenseive.
I hearby revoke any vote I made in favor of a new loop stucture, and vote
strongly against do {} while {} or any of the other propsals.
I no longer accept the 'let the programmer decide' argument for design because
Cold is a social language in that it begs for group work. That being the case,
its design should be such that bad code design is not possible or very hard
to use.
Crag / Robert