One of the (many) things on my TODO list is to add some sort of
reflection mechanism for examinging the status of bindings --
standard, active, delayed but evaluated, delayed but not yet
evaluated, etc. The interface might have a flavor like
bindingStatus(name, envir) returns one of "standar
On 9/9/2009 10:53 AM, Hadley Wickham wrote:
I don't think so in R code, but C code to do it would be possible. It needs
to be in C code to avoid forcing the promise.
Thanks Duncan - I thought that might be the case.
I think we'd be reluctant to make an R function available to do this,
becaus
You are right,
in the first time that I read the post, I understand incorrectly the
question.
On Wed, Sep 9, 2009 at 12:09 PM, Simon Urbanek
wrote:
>
> On Sep 9, 2009, at 9:40 , Henrique Dallazuanna wrote:
>
> If I understand your question, you can get the environment with sys.frame:
>>
>> f
On Sep 9, 2009, at 9:40 , Henrique Dallazuanna wrote:
If I understand your question, you can get the environment with
sys.frame:
f <- function(code){
print(sys.frame())
^-- this will always return R_GlobalEnv (see ?sys.frame - which = 0 by
default) regardless of the function and promi
> I don't think so in R code, but C code to do it would be possible. It needs
> to be in C code to avoid forcing the promise.
Thanks Duncan - I thought that might be the case.
> I think we'd be reluctant to make an R function available to do this,
> because it requires non-standard evaluation, a
On 9/9/2009 9:30 AM, Hadley Wickham wrote:
Hi all,
Is it possible to determine the environment in which a promise will be
evaluated? e.g.
f <- function(code) { force(code) }
f({
a <- 1
b <- 2
})
Is there any way to tell from within f that a and b will be created in
the global environment?
If I understand your question, you can get the environment with sys.frame:
f <- function(code){
print(sys.frame())
force(code)
}
f({
a <- 1
b <- 2
})
On Wed, Sep 9, 2009 at 10:30 AM, Hadley Wickham wrote:
> Hi all,
>
> Is it possible to determine the environment in which a promise wi
Hi all,
Is it possible to determine the environment in which a promise will be
evaluated? e.g.
f <- function(code) { force(code) }
f({
a <- 1
b <- 2
})
Is there any way to tell from within f that a and b will be created in
the global environment?
Thanks,
Hadley
--
http://had.co.nz/
___