Skip to content

env_binding_are_active evaluates active bindings twice #1376

Closed
@MilesMcBain

Description

@MilesMcBain

Probably unexpected, and prevents this function from being used over bindingIsActive.

In rlang 1.0.2:

f <- local( {
    x <- 1
    function(v) {
       if (missing(v))
           cat("get\n")
       else {
           cat("set\n")
           x <<- v
       }
       x
    }
})
makeActiveBinding("fred", f, .GlobalEnv)
rlang::env_binding_are_active(.GlobalEnv, "fred")
#> get
#> get
#> fred 
#> TRUE

Created on 2022-03-09 by the reprex package (v2.0.1)

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions