You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
There are some inconsistencies in how one-liner ggproto methods are written, with and without {. As far as I can tell, { for one-liners seems like an arbitrary stylistic choice in the source code
library(ggplot2)
Geom$setup_data#> <ggproto method>#> <Wrapper function>#> function (...) #> setup_data(...)#> #> <Inner function (f)>#> function (data, params) #> dataStat$setup_data#> <ggproto method>#> <Wrapper function>#> function (...) #> setup_data(...)#> #> <Inner function (f)>#> function (data, params) #> {#> data#> }
It's my understanding that starting a function body with { is more standard. It lets methods show up on the RStudio outline pane and also some debugging functions require it (ex: trace() with an at argument).
A quick search finds a few hits for one-liners without { like Geom$setup_data:
Thanks for the issue June! I believe from our prior discussion that one-liners are also untrace()able, right? In any case, if it is harmless and { is preferred, I see no obstacles for a PR :)
There are some inconsistencies in how one-liner ggproto methods are written, with and without
{
. As far as I can tell,{
for one-liners seems like an arbitrary stylistic choice in the source codeIt's my understanding that starting a function body with
{
is more standard. It lets methods show up on the RStudio outline pane and also some debugging functions require it (ex:trace()
with anat
argument).A quick search finds a few hits for one-liners without
{
likeGeom$setup_data
:This should be a trivial, non-intrusive chore that's easy to unit test. I'm happy to PR this if it seems within scope!
The text was updated successfully, but these errors were encountered: