On 7 Oct 2019, at 13:47, Duncan Murdoch <murdoch.duncan at gmail.com> wrote:
On 07/10/2019 4:22 a.m., Lionel Henry wrote:
There is another way the pipe could go into base R that could not be
done in package space and has the potential to mitigate some pretty
serious downsides to the pipes relating to debugging
I assume you're thinking about the large stack trace of the magrittr
pipe? You don't need a parser transformation to solve this problem
though, the pipe could be implemented as a regular function with a
very limited impact on the stack. And if implemented as a SPECIALSXP,
it would be completely invisible. We've been planning to rewrite %>%
to fix the performance and the stack print, it's just low priority.
I don't know what Gabe had in mind, but the downside to pipes that I see is that they are single statements. I'd like the debugger to be able to single step through one stage at a time. I'd like to be able to set a breakpoint on line 3 in
a %>%
b %>%
c %>%
d
and be able to examine the intermediate result of evaluating b before piping it into c. (Or maybe that's off by one: maybe I'd prefer to examine the inputs to d if I put a breakpoint there. I'd have to try it to find out which feels more natural.)