Thank you, Gentlemen...much appreciated!
peter bosa
metro
transportation research and modeling services
600 ne grand ave
portland, or 97232
peter.b...@oregonmetro.gov
503.797.1771
metro | making a great place
www.oregonmetro.gov
From: Tomas Kalibera
Sent: Wednesday, August 23, 2017 12:54 AM
To: Peter Bosa
Cc: Lionel Henry; Martin Maechler; R-devel@r-project.org
Subject: Re: [Rd] Possible repeat{} / break function bug in R 3.4.1
Fixed in 73112.
If you needed to run this code in unpatched versions of R, you can
disable the problematic compiler optimization in the loop for instance
by adding "eval(NULL)" to the body of the loop. However, please do not
forget to remove this for future versions of R and specifically do not
assume this would turn off a particular compiler optimization in future
versions.
Best
Tomas
On 08/23/2017 09:24 AM, Tomas Kalibera wrote:
> It is a bug in the byte-code compiler. I will fix
> Tomas
>
> On 08/23/2017 09:22 AM, Lionel Henry wrote:
>> I don't think that's a bug. source() uses eval(), and eval() creates a
>> new function-like context frame. In a way expecting `break` to work
>> inside source() is like expecting `break` to cross stack frames:
>>
>> my_break <- function() break
>> repeat(my_break())
>>
>> Lionel
>>
>>
>>> On 23 août 2017, at 09:17, Martin Maechler
>>> wrote:
>>>
>>>>>>>> Martin Maechler
>>>>>>>> on Wed, 23 Aug 2017 09:10:20 +0200 writes:
>>>>>>>> Peter Bosa
>>>>>>>> on Tue, 22 Aug 2017 14:39:50 + writes:
>>>>> Hello, I've noticed the following error using repeat{} / break in
>>>>> R 3.4.1 running on Windows 10 and Windows Server 2008 (both 64-bit
>>>>> environments).
>>>>> When running a repeat function, the break command causes an error
>>>>> message if the repeat command refers to code within a file, but
>>>>> does not produce an error if the code is contained within the
>>>>> repeat{} command.
>>>>> Hello, I've noticed the following error using repeat{} / break in
>>>>> R 3.4.1 running on Windows 10 and Windows Server 2008 (both 64-bit
>>>>> environments).
>>>>>
>>>>> When running a repeat function, the break command causes an error
>>>>> message if the repeat command refers to code within a file, but
>>>>> does not produce an error if the code is contained within the
>>>>> repeat{} command.
>>>>>
>>>>> For example, the following code runs fine:
>>>>>
>>>>> x <- 1
>>>>> y <- 5
>>>>>
>>>>> repeat {
>>>>> if(x < y) {
>>>>> print("No Break Dance :-(")
>>>>> x = x + 1
>>>>> } else {
>>>>> print("Break Dance!")
>>>>> break
>>>>> }
>>>>> }
>>>>>
>>>>> [1] "No Break Dance :("
>>>>> [1] "No Break Dance :("
>>>>> [1] "No Break Dance :("
>>>>> [1] "No Break Dance :("
>>>>> [1] "No Break Dance :("
>>>>> [1] "Break Dance!"
>>>>> However, if I take the loop contents of the repeat{} function, and
>>>>> save them to a file (breakTest.R) that contains the following:
>>>>>
>>>>> if(x < y) {
>>>>> print("No Break Dance :-(")
>>>>> x = x + 1
>>>>> } else {
>>>>> print("Break Dance!")
>>>>> break
>>>>> }
>>>>>
>>>>> And then run the following code:
>>>>>
>>>>> x <- 1
>>>>> y <- 5
>>>>>
>>>>> repeat{
>>>>> source("./breakTest.R")
>>>>> }
>>>>>
>>>>> I get the following error:
>>>>>
>>>>> [1] "No Break Dance :("
>>>>> [1] "No Break Dance :("
>>>>> [1] "No Break Dance :("
>>>>> [1] "No Break Dance :("
>>>>> [1] "No Break Dance :("
>>>>> [1] "Break Dance!"
>>>>> Error in eval(ei, envir) : no loop for break/next, jumping to top
>>>>> level
>>