Hello, Ladislav, >It is telling For, that instead >of taking Exit as a signal for itself to exit, it must throw it >further (to F). I think I either don't understand the problem properly, or else RT heard you and corrected the problem already. When I tried to do f: does [print "Hello" for i 1 10 1 [exit] print "You won't see this"] and run it, it exits f properly. I am assuming that in an old version it would exit the for loop and keep running, so that the user would in fact see: >>f You won't see this Is that the case? If so, RT has fixed it in my View and Core, which are 09931 and 23031 respectively. I may be all wet here, but if they have fixed it, it is probably in part due to your hard-won research and reporting of the problem. -Galt >===== Original Message From "Ladislav Mecir" <[EMAIL PROTECTED]> ===== >Not exactly. The problem is, what can be considered a Rebol bug. > >1. Exit/Return: the normal behaviour is, that any function >encountering Exit takes it as an instrunction for itself to exit >like: > > f: does [print "Hello" exit print "You won't see this"] > >The "problem" is, that some functions like For, Forskip, Foreach, >Forall, While, Repeat, Loop, Any, All, If, Either, ... take a >Rebol code as their Block argument (or whatever name they use for >it). Now an example: > > f: does [print "Hello" for i 1 10 1 [exit] print "You won't >see this"] > >Here the function encountering the Exit you see on the line is not >F as you might think at first, but For. For this code to work >"properly", For shall know, that the Exit it encountered is meant >as a signal for another function (F in this case). That's the >reason d'etre for Throw attribute. It is telling For, that instead >of taking Exit as a signal for itself to exit, it must throw it >further (to F). > >So, once again: Throw is a Carl's solution of the "foreign >Return/Exit" problem and you should use it whenever you program >your own "Rebol control functions" ie. the functions that take >Rebol code blocks and interpret them. > >FYI: there is a similar problem of "foreign Break", that remains >unsolved. (I found a work-around, when I programmed >www.rebol.org/general/pif.r). >
