wmb@MITCH.ENG.SUN.COM (Mitch Bradley) (02/13/91)
> JS> : THRU ( 1st last) > JS> 1+ OVER - > JS> FOR DUP PUSH LOAD POP 1+ ?SCROLL NEXT DROP ; : THRU ( first last -- ) 1+ SWAP DO I LOAD LOOP ; You see, DO .. LOOP does have its advantages in some applications. I find it amusing that Chuck introduced a bug in cmForth because of his zeal for eliminating DO .. LOOP Mitch
wmb@MITCH.ENG.SUN.COM (Mitch Bradley) (02/21/91)
> If the FOR NEXT approach of using 1 parameter is more usefull, > I'd find it strange to recognize this fact by using 0 ?DO LOOP > to express that idea. If we were designing a language from scratch, then we would have the freedom of doing things "right" to this level of optimization. However, when you are dealing with 15+ years of history and thousands of programmers and hundreds of thousands of lines of existing code, it is often not worth changing something to make it a little better. > By the way I is also inappropriate ... > In my opion ONE UPCOUNTING index is so scarcely used that using the > DO LOOP's I index is often inconvenient. My mileage differs. I use "I" quite frequently. > ... discussion of the visibility/name of the FOR NEXT loop index and > the name of the FOR NEXT equivalent of LEAVE and the behavior/name of > FOR with a 0 argument ... In Basis 15, FOR .. NEXT will have been removed entirely. There were so many controversial issues around FOR .. NEXT that the committee just got fed up with the whole thing and chucked it. In my opinion, this was an appropriate response. Even though FOR .. NEXT is nice (in some of its variations), it doesn't really give you new capability. I just can't get all that worked up about using the word FOR instead of 0 ?DO . I mean, FOR is a little nicer, but so what? It's just not a big deal. To keep the index addressing uniform I therefore propose to use on (data:)stack indexes. > .. discussion of names, proposing ?FOR .. PASS .. NEXT Those names sound fine to me; they don't conflict with any existing usage that I know of. Mitch