REBOL3 tracker
  0.9.12 beta
Ticket #0001951 User: anonymous

Project:



rss
TypeBug Statuspending Date15-Feb-2013 02:37
Versionr3 master CategoryNative Submitted byBrianH
PlatformAll Severityminor Prioritynormal

Summary DO/next doesn't set var when /next doesn't apply
Description The DO function's /args and /next options only apply to certain datatypes, and they are ignored for the other datatypes DO accepts. In the case of /args this doesn't matter once the DO function returns, because it was going to get reset anyway. However, the /next option is supposed to set the var word, and when /next is inapplicable that word is left with its previous value.

We should decide whether this is the appropriate behavior. If so, we need to document it and test for it. If not, we either need to trigger an error when the option is inapplicable, or set var to another value like none.

(Rephrase this ticket as a bug if we decide to change the behavior.)
Example code
; Current behavior
>> a: 1 do/next 2 'a a
== 1

Assigned ton/a Fixed in- Last Update23-Mar-2014 13:53


Comments
(0003444)
Ladislav
15-Feb-2013 10:28

Well, since /next refinement is actually ignored in the process (except for collecting the arguments), I do not object against DO not setting the variable in the example.
(0003447)
BrianH
15-Feb-2013 18:41

I really don't mind either, but if that is the choice we go with then we need to add it to the docs and test for it in the test suite. Whatever approach we go with will have implications for user code, so we'll have to make sure that whatever we choose is documented and verified to happen.

Personally, I prefer to have the /next option set the word to none. Silent failures are the worst failures, and if you have specified /next it means you're expecting the word to get set to something. It not getting set is a silent failure.

Given that, here's a fix: https://github.com/rebol/rebol/pull/206
(0004374)
abolka
23-Mar-2014 13:53

I'd slightly prefer having an error triggered, when /next is not applicable.

Date User Field Action Change
23-Mar-2014 13:53 abolka Comment : 0004374 Added -
6-Mar-2014 06:33 BrianH Comment : 0003447 Modified -
6-Mar-2014 06:32 BrianH Description Modified -
6-Mar-2014 06:32 BrianH Code Modified -
6-Mar-2014 06:32 BrianH Status Modified submitted => pending
6-Mar-2014 06:32 BrianH Type Modified Issue => Bug
5-Mar-2014 08:51 BrianH Comment : 0003447 Modified -
15-Feb-2013 18:41 BrianH Comment : 0003447 Added -
15-Feb-2013 10:28 Ladislav Comment : 0003444 Added -
15-Feb-2013 02:37 BrianH Ticket Added -