Inheritance-style lookup of function from within a closure.
Usage
super(fun)
Arguments
fun
|
the name of the function we are looking for
|
Description
Finds a function in ancestor environments of the current one,
so that we can avoid local defintions.
This is used in the CORBA facilities within a closure
when we provide a local function with an implicit this.
Then we use super to find the real function and supply it
the explicit this.Details
Value
a function definition for the specified name.Author(s)
Duncan Temple Lang, Ross IhakaSee Also
closureExamples
# define a closure.
cl <- function(this) {
# define a local nrow which calls the global one.
nrow <- function() {
super(nrow)(this)
}
return(list(nrow=nrow))
}
# create a closure from the generator
mobj <- cl(matrix(1:9,3,3))
# call the closure's nrow() function
mobj$nrow()