-
Notifications
You must be signed in to change notification settings - Fork 64
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
Feature: Stricter addition #286
Comments
Reprex: 1L + glue::glue("y")
#> 1y Created on 2023-01-25 with reprex v2.0.2 |
And shouldn't it be vectorised? "(" + glue::glue(c("y", "z")) + ")"
#> Error: All unnamed arguments must be length 1 Created on 2023-01-26 with reprex v2.0.2 |
And this seems wrong: glue::glue("{x}", x = "{x}") + "y"
#> Error in eval(parse(text = text, keep.source = FALSE), envir): object 'x' not found Created on 2023-01-26 with reprex v2.0.2 We're interpolating the string twice |
Note to self, making the last example even more obvious glue::glue("{x}", x = "{wut}")
#> {wut}
glue::glue("{x}", x = "{wut}") + "y"
#> Error in eval(parse(text = text, keep.source = FALSE), envir): object 'wut' not found Created on 2023-03-17 with reprex v2.0.2.9000 |
I'm about to merge #297 because it's definitely progress. But just want to note this is also connected to #246. When that gets addressed, make sure to test With #297: library(glue)
str(as_glue("foo") + character())
#> 'glue' chr "foo"
str(glue("foo{x}", x = character()))
#> 'glue' chr(0) With glue v1.6.2: library(glue)
str(as_glue("foo") + character())
#> 'glue' chr(0)
str(glue("foo{x}", x = character()))
#> 'glue' chr(0) |
* Improve addition method Fixes #286 * Add test re: double interpolation --------- Co-authored-by: Jennifer (Jenny) Bryan <jenny.f.bryan@gmail.com>
The binary addition operator currently has the following implementation
Would it be desirable to be a little stricter here and maybe error if one of the inputs is not a character / glue object. It feels like the following would be better to error:
Created on 2023-01-11 with reprex v2.0.2
The text was updated successfully, but these errors were encountered: