But, here, the default was the right move, because the "o" exists in the
.oapply call environment, which corresponds to the parent.frame() evaluated
inside eval().


On Thu, Nov 7, 2013 at 6:14 PM, Karl Forner <karl.forner@gmail.com> wrote:

> Of course, sorry for that, this default is evaluated inside eval() so it's
> not the same as the current parent.frame().
>
>
> On Mon, Oct 28, 2013 at 8:44 PM, Hadley Wickham <notifications@github.com>wrote:
>
>> In R/reporter-multi.r:
>>
>> > +    },
>> > +    end_test = function() {
>> > +      .oapply(reporters, 'end_test')
>> > +    },
>> > +    end_context = function() {
>> > +      .oapply(reporters, 'end_context')
>> > +    },
>> > +    end_reporter = function() {
>> > +      .oapply(reporters, 'end_reporter')
>> > +    }
>> > +  )
>> > +)
>> > +
>> > +.oapply <- function(objects, method, ...) {
>> > +  for (o in objects)
>> > +    eval(substitute(o$FUN(...), list(FUN = method, ...)))
>>
>> It's the default, but it's evaluated in a different environment depending
>> on whether or not you supply it:
>>
>> x <- 1f1 <- function(expr) {  x <- 2  eval(substitute(expr))}f2 <- function(expr) {  x <- 2  eval(substitute(expr), parent.frame())}f1(x)f2(x)
>>
>> —
>> Reply to this email directly or view it on GitHub<https://github.com/hadley/testthat/pull/98/files#r7260652>
>> .
>>
>
>