Path: utzoo!utgpu!jarvis.csri.toronto.edu!cs.utexas.edu!uwm.edu!lll-winken!decwrl!purdue!bouma From: bouma@cs.purdue.EDU (William J. Bouma) Newsgroups: comp.lang.forth Subject: Re: New Directions: 'I' is broken in Forth Summary: for next do loop Message-ID: <9359@medusa.cs.purdue.edu> Date: 23 Jan 90 19:19:46 GMT References: <9001231635.AA14088@jade.berkeley.edu> Organization: Department of Computer Science, Purdue University Lines: 23 >The last I heard, Chuck had repented of having invented DO .. LOOP , >preferring FOR .. NEXT instead. I believe that he felt strongly enough >about it to have lobbied for the removal of DO .. LOOP from the ANSI >standard. > >Mitch Besides the names, what is the difference? There is nothing wrong with the do-loop in forth other than the ugly way the index variable is handled. In my system you must explicitely declare the index variable after the 'do'. At compile time the do grabs the next word and makes sure it is a variable. It then compiles code to store the initial value in the memory location of that variable. Loop likewise compiles code to update that variable. ok, : junk variable x 10 1 do x x @ . loop ; ok, junk 1 2 3 4 5 6 7 8 9 ok, quit -- Bill || ...!purdue!bouma