[comp.lang.forth] Optimizations

wmb@MITCH.ENG.SUN.COM (02/15/91)

> I tend to agree on the readability & don't consider Mitch's 0 ?DO a real
> solution, letting the programmer type what he knows will be 'ignored' by
> the compiler.(see below)

Why is this optimization any different from any other optimization?

If the compiler can generate better code by recognizing a special case,
then why not let it do so?

I have nothing against the concept of FOR .. NEXT ; I would have been
perfectly happy if Forth had started out with FOR .. NEXT instead of
DO .. LOOP .  But it didn't, and the advantages of FOR .. NEXT over
DO .. LOOP are just not great enough to justify all the fuss and effort
of changing it.  I can think of hundreds of issues that are much more
important that whether  FOR  looks better than  0 ?DO .  Don't we have
anything better to do than to change little things like this?

There is one serious problem with FOR .. NEXT nowadays:  I don't know what
it means anymore.  It's original meaning is to execute the loop n+1 times,
but now in Rob's and Frank's systems, it executes n times.

Please, people, if you are going to change the meaning of something, give
it a different name.  There is nothing magic about the name FOR; there are
lots of better names.  Leave FOR to mean what it means in previous systems
(execute n+1 times, brain-damaged as it is), and pick a different name for
the "execute n times" version.  Perhaps TIMES or ?FOR or #DO or whatever.

(There is one less-serious problem too: what is the name of the FOR .. NEXT
loop index?).

Mitch Bradley, wmb@Eng.Sun.COM