glue icon indicating copy to clipboard operation
glue copied to clipboard

Feature request/question: Extract the code to be evaluated

Open billdenney opened this issue 5 months ago • 1 comments

I want to warn users if not all items they pass to a function are passed to a glue specification (related to billdenney/ggtibble#13). As a pseudocode example, I'd like to be able to do something like:

extract_glue_expressions <- function(x) {
  # return all expressions in `x`
}

When I looked for the place in the code where this may happen, I found

https://github.com/tidyverse/glue/blob/05e85e18694929d713fd5b8e25b55abb0c18a2fc/R/glue.R#L179

but, this already does the substitution.

Is there any supported way to get the unevaluated expressions before substitution?

I'd guess if I captured the expression as it goes into this code (https://github.com/tidyverse/glue/blob/05e85e18694929d713fd5b8e25b55abb0c18a2fc/R/glue.R#L150-L176), I could have the list, but that does not appear to be in the current API.

billdenney avatar Aug 26 '24 20:08 billdenney