Settling the issue of FORALL once and for all.
As some of you may know, and some of you may just now find out, the FORALL function has a strange side effect that makes it problematic for beginners (and perhaps some experts too). If we intend to ever change the behavior of FORALL, it must be done now in REBOL/View 1.3 or forever hold our peace.
The original design of FORALL was to make it a macro for a common pattern that occurred when using the WHILE function. Here is an example:
while [not tail? series][ do something series: next series ]
forall series [ do something ]
And it is important to note that the side effects are very similar: mainly that the series is now at its tail position.
And that is the problem encountered by most beginners. They don't realize that the series is now at its tail. Subsequent use of the series may be problematic. The normal practice is to follow the above code with a line such as this:
series: head series
This is very common - in fact it is so common that many users believe the FORALL function should include it (or something similar - returning to the initial position).
Although this change will help beginners, it may also break some code, here and there. So, before we make this change to the upcoming release, it would be good to have a small debate as to its merits. We do not want to make this change if you think you it will break too much code. Tell me what you think or discuss it with others on the e-mail list or in one of the REBOL worlds. But, do not wait too long... 1.3 is nearly ready for release.
Also note that the same change will be made to the FORSKIP function.
Updated 26-May-2023 - Copyright Carl Sassenrath - WWW.REBOL.COM - Edit - Blogger Source Code