Open DavisVaughan opened 1 month ago
I'm also on board with just using string_content. It also allows us to discount the delimiter, since these all do the same thing:
foo <- 1
"foo" <- 1
'foo' <- 1
`foo` <- 1
and it's more in line with the "truth", which is a variable called foo
is created, regardless of its delimiters.
Not to mention, raw strings 😅
Yea, raw strings are a huge pain:
R"----------(why is this allowed?)----------" <- \(x) x
`why is this allowed?`(2)
# [1] 2
Probably a separate bug, but I notice there's no support for right-assigned functions:
(function(x) { x }) -> foo
foo(2)
# [1] 2
This is a monstrosity (in my ever-so humble opinion), but does come up in CRAN packages:
Note that due to operator precedence ()
-wrapping is required.
Like
"$<-.data.table"
in data.table https://github.com/Rdatatable/data.table/blob/4d42cdc4f73084390eccc589e726519556c1f8a1/R/data.table.R#L2257-L2264Not sure exactly what we should tag as the
@name
, probably just the whole string including the string delimiters? I think if we naively drop the delimiters and use thestring_content
we could have issues in the case of"name \" with dquote"
because you end up with this\
in the captured text that would have to be unescaped to getname " with dquote
. Seems a little complicated.Then again, maybe if it works better in the 99% case with
string_content
, we should just do that and be ok with problems in the 1% case?