Pragmatic Programming and The Practice of Programming both promote the principle of "once and only once" (OOO), or "don't repeat yourself" (DRY). This is a great piece of advice when writing programs, but doesn't really apply when designing a language. Larry has proven this time and time again with Perl, yet people still like to misapply the OOO principle to the domain of language design.
Here's a case in point, courtesy of David Megginson via the xml-dev list:
> W3C has violated a first-order principle of language design; that
> there should only be one way of doing something, such that everyone
> ought to devise the 'same' program to solve the 'same' problem.
int x = 0;
while (x < 10) {
printf("hello\n");
x++;
}
int x;
x = 0;
do {
printf("hello\n");
} while (x++ < 10);
int x;
for (x = 0; x < 10; x++)
printf("hello\n");
/* etc. */
It's clearly a principle rarely put into practice (I won't even start on the Common LISP looping constructions).
Why OOO doesn't apply (Score:1)
Different looping constructs may be used to acheive the same end, yet their means may differ; there are often memory, performance, or maintainability (ie readability/debugability/ease of alteration, etc) tradeoffs involved.
Even though TIMTOWTDI may seem profligate, in reality there are often subtleties at play that are not manifest in the
Re:Why OOO doesn't apply (Score:2)
Yep. Someone said later in that thread that OOO is fundementally wrong at the language design level, using Scheme as an example. Specifically, the idea that you do not need iteration whatsoever, since all iteration can be expressed in terms of recursive functions.
Don't even get me started on the fallacy that the only data structure yo