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
Refactor interp() #15
Conversation
@@ -319,8 +319,8 @@ fml_default <- function(expr, fn) { | |||
#' @export | |||
#' @examples | |||
#' # The missing argument can be useful to generate calls | |||
#' f_interp(~f(x = uq(arg_missing()))) | |||
#' f_interp(~f(x = uq(NULL))) | |||
#' interp(~f(x = UQ(arg_missing()))) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Did you want to use !!
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
so should we promote !!
as the default way of unquoting? I'd like that.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, I think so
#' with the evaluated value of \code{x}, and inlines sub-expressions | ||
#' of the form \code{UQS(x)}. Syntactic shortcuts are provided for | ||
#' unquoting and unquote-splicing by prefixing with \code{!!} and | ||
#' \code{!!!}. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm still not sure about !!!
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I really like it but it's your call ;)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok, let's just go with it. I can't see an option that's better (unless we use !!.
or !!?
)
#' | ||
#' # However you need to be a bit careful with operator precedence. | ||
#' # All arithmetic and comparison operators bind more tightly than `!`: | ||
#' interp(x ~ 1 + !! (1 + 2 + 3) + 10) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh that's a major downside 😞
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes :/
94b94db
to
62e6c2b
Compare
For symmetry with f_env()
It's going to replace old lazyeval::interp() and support formulas as well as closures.
And allow splicing of language objects (with automatic extraction of quoted curlies)
Caused by function called `splice()`...?
62e6c2b
to
6cfc0ec
Compare
f_interp()
tointerp()
and add interpolation of closures.UQS()
handle language objects. This is useful for interpolating bodies of closures.!!
,!!!
, and`!!`()
shortcuts for unquoting and splicing.