[Rd] E`<`<rrors in recursive default argument references

Stavros Macrakis macrakis at alum.mit.edu
Mon Mar 9 23:31:40 CET 2009


On Mon, Mar 9, 2009 at 5:40 PM, Wacek Kusnierczyk
<Waclaw.Marcin.Kusnierczyk at idi.ntnu.no> wrote:
> Stavros Macrakis wrote:
>> Tested in: R version 2.8.1 (2008-12-22) / Windows

> when i run these examples, the execution seems to get into an endless
> loop with no error messages whatsoever.  how much time does it take
> before you get the error?  (using r 2.8.0 and also the latest r-devel).

In 2.8.1/Windows (32 bit), they return immediately, though the
stack-overflow case is about 13x slower.

> system.time(for (i in 1:100) {trySilent((function(a=a)(a))())})
   user  system elapsed
   0.67    0.00    0.67
> system.time(for (i in 1:100) {trySilent((function(a=a)as.POSIXct(a))())})
   user  system elapsed
   0.05    0.00    0.05

Are you running under 64 bits?  How long does a vanilla infinite
recursion take to fail on your machine?  I get:

> system.time(for (i in 1:100) trySilent({fff <- function()fff(); fff()}))
   user  system elapsed
   0.27    0.00    0.26

         -s



More information about the R-devel mailing list