Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Wrong semantics of .env pronouns #174

Closed
lionel- opened this issue Jun 13, 2017 · 0 comments
Closed

Wrong semantics of .env pronouns #174

lionel- opened this issue Jun 13, 2017 · 0 comments

Comments

@lionel-
Copy link
Member

@lionel- lionel- commented Jun 13, 2017

The .env pronouns currently refer to the environment of the outermost quosure:

inner_quo <- local({
  foo <- "foo"
  quo(.env$foo)
})

outer_quo <- local({
  foo <- "bar"
  quo(identity(!! inner_quo))
})

outer_quo
#> <quosure: local>
#> ~identity(~.env$foo)

eval_tidy(outer_quo)
#> [1] "bar"

I think this is incorrect because inner quosures do not own the dynamic environments of outer quosures. Furthermore, this creates inconsistencies due to quosure inlining:

inlined_quo <- local({
  foo <- "bar"
  quo(!! inner_quo)
})

eval_tidy(inlined_quo)
#> [1] "foo"

It should be safe to fix this behaviour as we didn't document this pronoun in dplyr's programming vignette.

lionel- added a commit to lionel-/rlang that referenced this issue Jun 29, 2017
@lionel- lionel- closed this in #202 Jun 29, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
1 participant