Native Pipe Backport
Closed this issue · 2 comments
Hi,
Thanks so much for your work on this package. Its a really great idea!
Don't know if its possible, but I'd love to use the native pipe |>
(introduced in R 4.1) in my packages without forcing everyone on less recent version to update.
Is this possible / in scope for backports
If not, do you have any ideas for alternative solutions?
I am pretty sure that's not possible, because |>
is not legal syntax in the earlier versions. I don't know any good workaround, but it might be possible to maintain two sets of sources for your functions: one that works in R 4.1, and one that works in earlier versions, which can be produced automatically by deparsing your code (since x |> f()
deparses to f(x)
). It would need a lot of care to get it right and keep it right, and probably isn't worth doing.
The alternative, much easier, way to support pre-4.1 R is to use magrittr
pipes instead. Or just skip pipes in your source code.
I also don't see a way to backport changes in the parser.