title: R: promise already under evaluation
body: <p>I understand that you are probably sick and tired of answering the same question again, but I am still getting the error discussed in <a href="https://stackoverflow.com/questions/4357101/promise-already-under-evaluation-recursive-default-argument-reference-or-earlie">several</a> <a href="https://stackoverflow.com/questions/3073746/r-error-promise-already-under-evaluation-when-using-subset-in-function-but-no-er">other</a> <a href="https://stackoverflow.com/questions/8425348/unexpected-behaviour-with-argument-defaults">questions</a>:</p>
  
  <blockquote>
    <p>promise already under evaluation: recursive default argument reference or earlier problems?</p>
  </blockquote>
  
  <p>even though I did follow the "cumbersome" advice of prepending <code>"."</code>:</p>
  
  <pre><code>show.large.objects.threshold &lt;- 100000
  show.large.objects.exclude &lt;- c("closure")
  show.large.objects &lt;- function (.envir = sys.frame(),
                                  threshold = show.large.objects.threshold,
                                  exclude = show.large.objects.exclude) {
    for (n in print(ls(.envir, all.names = TRUE))) tryCatch({
      o &lt;- get(n,envir = .envir)
      s &lt;- object.size(o)
      if (s &gt; threshold &amp;&amp; !(typeof(o) %in% exclude)) {
        cat(n,": ")
        print(s,units="auto")
      }
    }, error = function(e) { cat("n=",n,"\n"); print(e) })
  }
  show.large.objects.stack &lt;- function (.threshold = show.large.objects.threshold,
                                        skip.levels = 1,# do not examine the last level - this function
                                        .exclude = show.large.objects.exclude) {
    for (level in 1:(sys.nframe()-skip.levels)) {
      cat("*** show.large.objects.stack(",level,") ")
      print(sys.call(level))
      show.large.objects(.envir = sys.frame(level), threshold = .threshold, exclude = .exclude)
    }
  }
  </code></pre>
  
  <p>but I still get errors:</p>
  
  <pre><code>&gt; f &lt;- function () { c &lt;- 1:1e7; d &lt;- 1:1e6; print(system.time(show.large.objects.stack())) }
  &gt; f()
  *** show.large.objects.stack( 1 ) f()
  [1] "c" "d"
  c : 38.1 Mb
  d : 3.8 Mb
  *** show.large.objects.stack( 2 ) print(system.time(show.large.objects.stack()))
  [1] "..." "x"  
  n= ... 
  &lt;simpleError in get(n, envir = .envir): argument "..." is missing, with no default&gt;
  n= x 
  &lt;simpleError in get(n, envir = .envir): promise already under evaluation: recursive default argument reference or earlier problems?&gt;
  *** show.large.objects.stack( 3 ) system.time(show.large.objects.stack())
  [1] "expr"    "gcFirst" "ppt"     "time"   
  n= expr 
  &lt;simpleError in get(n, envir = .envir): promise already under evaluation: recursive default argument reference or earlier problems?&gt;
            user         system        elapsed 
      0 (0.00ms)     0 (0.00ms) 0.002 (2.00ms) 
  </code></pre>
  
  <ol>
  <li>So, what am I still doing wrong?</li>
  <li>Do I <em>really</em> need the <code>.</code> in <code>.envir</code>? What about <code>.exclude</code> and <code>.threshold</code>?</li>
  <li>Why do I get the <code>argument "..." is missing, with no default</code> error?</li>
  <li>Why do I get the <code>promise already under evaluation</code> error?</li>
  </ol>
  
  <p>Thanks!</p>