On Dec 22, 2006, at 3:54 AM, Abigail wrote:
Why stop at 'if' and 'unless'? Given a 'while', why bother having a
'for'?
You have it backwards. for(;;) provides *semantics* that can't be
easily provided by while(), so it's more "given a 'for', why bother
having a 'while'", and there's been a few C programmers who eschew
while() as a result.
Though I have to say that I've come around to seeing "#define EVER ;;"
as hateful.
But you're missing the point.
"while()" and "for(;;)" are not "more than one way of doing things".
"if" and "unless" are not "more than one way of doing things".
In both cases, these are "one way of doing things, with two different
syntaxes".
When you look at languages that really *have* the kind of flexibility
that allows the programmer to create "more than one way of doing
things", Perl looks like a little kid showing up at the office with his
dad's tie and boots and claiming he can do the job.
Compare generators in Icon or Smalltalk, or using introspection and
reflection to *create* new control structures like 'if' and 'unless'
and 'while' and 'for' in Lisp-family languages, or the ultimate
machine-code-to-4gl flexibility in Forth, to Perl's rigidly defined
areas of doubt and uncertainty, and you'll begin to see just how
hateful this bogus claim about Forth really is.