Closed egnha closed 3 years ago
You can see what's happening if you remove the pipe:
ignore <- function(x) "return value"
ignore(stop("never called"))
#> [1] "return value"
{
stop("never called")
"return value"
}
#> Error in eval(expr, envir, enclos): never called
Created on 2020-09-09 by the reprex package (v0.3.0.9001)
Perhaps it would then be helpful to document the fact that x %>% {...}
forces x
. (Or put differently, that x %>% {...}
and x %>% (function(.) ...)
are not strictly equivalent.)
That fact is sufficiently esoteric that I'm not sure including it in the documentation would help anyone.
According to NEWS.md, as of 1.5.0.9000
%>%
won't force the LHS.Example from NEWS.md:
However, the equivalent expression using
{...}
forces the LHS:Is this the expected behavior? (Or have I misunderstood the semantics of
{...}
?)