REBOL3 tracker
  0.9.12 beta
Ticket #0001519 User: anonymous

Project:



Short URL: http://issue.cc/r3/1519
rss
TypeBug Statusbuilt Date12-Mar-2010 22:24
Versionalpha 97 CategoryError Handling Submitted byBrianH
PlatformAll Severityminor Prioritynormal

Summary Unwind functions don't propagate from WHILE condition block
Description The unwind functions: RETURN, EXIT, BREAK, CONTINUE, THROW.

The unwinding process doesn't propagate from within the WHILE condition block because WHILE doesn't return the unwind values from there (or any values for that matter). If WHILE could check for unwind values returned from the condition block then it could act on BREAK and CONTINUE, or return the rest from the function so they can propagate. As it is now in R3, WHILE treats the unwind value like an untriggered error! and considers it true, which often leads to an endless loop.

This is related to bug #1509, but that refers to function argument processing by DO, while this refers to WHILE.

Note that the behavior of R2 should not be emulated: It is also in error, but a different error.
Example code
>> do does [while [return 'good] [print 'bad]]
bad
bad
; ... in an endless loop
>> do does [while [return 'good] [return 'bad]]
== bad  ; should be good

Assigned ton/a Fixed inr3 master Last Update19-Feb-2014 20:05


Comments
(0002756)
Ladislav
2-Nov-2010 12:00

in the core-tests suite
(0002835)
BrianH
11-Nov-2010 16:19

Weird: I was expecting QUIT and HALT to be caught by this as well, but they aren't, and not by #1760 either.
(0003396)
BrianH
24-Jan-2013 03:47

Expanded the tests for this in core-tests. As of alpha 111, BREAK and CONTINUE apparently work in the condition block, but the other unwinds aren't passed through. Doesn't work in R2 either, but it's a bug there too.

Date User Field Action Change
19-Feb-2014 20:05 BrianH Fixedin Modified => r3 master
19-Feb-2014 20:05 BrianH Status Modified reviewed => built
24-Jan-2013 03:47 BrianH Comment : 0003396 Added -
23-Jan-2013 22:48 BrianH Status Modified submitted => reviewed
11-Nov-2010 16:19 BrianH Comment : 0002835 Added -
11-Nov-2010 16:12 BrianH Description Modified -
11-Nov-2010 16:12 BrianH Code Modified -
2-Nov-2010 12:00 Ladislav Comment : 0002756 Added -
12-Mar-2010 22:24 BrianH Ticket Added -