diffobj (version 0.1.2)

par_frame: Get Parent Frame of S4 Call Stack

Description

Implementation of the function(x=parent.frame()) ... pattern for the diff* methods since the normal pattern does not work with S4 methods. Works by looking through the call stack and identifying what call likely initiated the S4 dispatch.

Usage

par_frame()

Arguments

Value

an environment

Details

The function is not exported and intended only for use as the default value for the frame argument for the diff* methods.

Matching is done purely by looking for the first repeated call which is what usual happens with S4 dispatch since there will be a call to the generic and then to the method. Since methods can be renamed by the user we make no attempt to verify method names. This method could potentially be tricked if you implement custom diff* methods that somehow issue two identical sequential calls before calling callNextMethod. Failure in this case means the wrong frame will be returned.