Errors in TDPL
eles
eles at eles.com
Wed Jun 23 16:41:38 PDT 2010
== Quote from bearophile (bearophileHUGS at lycos.com)'s article
> Alix Pexton:
> > In some ways I think it was a mistake in to reuse while in the
first
> > place, but that was a decision that was made a loong time before
D...
> Pascal-like languages use repeat-until, but I prefer the C do-while
because the condition in repeat-until is the opposite of the one you
use in a while loop, and every time I use repeat-until I have to
remember what's the correct stopping condition to write.
Quite the oposite here. When I have a loop like that, I think rather
about the exit condition (so in terms of "repeat/until"). This is why
I often write:
do{
//code
} while(!([exit_condition_here]));
I also think re-using while() in the do ... while loop is a mistake,
exactly because of difficulties arising in code maintenance.
I would like to have another keyword for that, or maybe the "repeat/
until" loop all-together.
It is a shame that compatibility issues prevail over quality and
improvement. Ditching the do...while loop could be unacceptable now,
but why do not propose a better alternative mechanism? That way, we
would have both compatibility and quality.
eles
> Bye,
> bearophile
More information about the Digitalmars-d
mailing list