Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix formals of compute_layer() #3244

Conversation

yutannihilation
Copy link
Member

@yutannihilation yutannihilation commented Apr 13, 2019

Fixes #3202

Stat*$compute_layer() and Position*$compute_layer() have various names of formals, which seems for no valid reason; just because the common formals were so at that time (c.f. #3202 (comment)).

It seems these methods are not passed parameters by name, but by positions only, so I think this is safe to fix:

$ git grep "compute_layer("
R/layer.r:    self$stat$compute_layer(data, params, layout)
R/layer.r:    self$position$compute_layer(data, params, layout)
R/position-.r:#'   - `compute_layer(self, data, params, panel)` is called once
R/stat-.r:#'     `compute_layer(self, data, scales, ...)`,
R/stat-.r:#'     `compute_layer()` is called once per layer, `compute_panel_()`
R/stat-bindot.r:    ggproto_parent(Stat, self)$compute_layer(data, params, panels)
man/ggplot2-ggproto.Rd:\code{compute_layer(self, data, scales, ...)},
man/ggplot2-ggproto.Rd:\code{compute_layer()} is called once per layer, \code{compute_panel_()}
man/ggplot2-ggproto.Rd:\item \code{compute_layer(self, data, params, panel)} is called once

This PR fixes the inconsistency. I expect this would break nothing, but changing the argument names is (technically) a breaking change. So, I added a NEWS item for this.

NEWS.md Outdated
@@ -121,6 +121,9 @@ core developer team.

* `sec_axis()` now accepts functions as well as formulas (@yutannihilation, #3031).

* `Stat$compute_layer()` and `Position$compute_layer()` now have the same names of
arguments (@yutannihilation, #3202).
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I feel something is missing here. "have now the same names of arguments as other compute_layer() functions"?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks. I should probably say something like "The arguments of Stat*$compute_layer() and Position*$compute_layer() are now renamed to match the ones of Stat$compute_layer() and Position$compute_layer()." Does this make sense...?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, maybe with this edit: "...now renamed to always match the ones...". After all, they mostly were matching already, but not always.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Got it!

Copy link
Member

@thomasp85 thomasp85 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@yutannihilation yutannihilation merged commit e52b6a8 into tidyverse:master Apr 24, 2019
@yutannihilation yutannihilation deleted the refactor/stat-compute-layer-consistent-args branch April 24, 2019 00:39
@lock
Copy link

lock bot commented Oct 21, 2019

This old issue has been automatically locked. If you believe you have found a related problem, please file a new issue (with reprex) and link to this issue. https://reprex.tidyverse.org/

@lock lock bot locked and limited conversation to collaborators Oct 21, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Inconsistent formals for StatIdentity$compute_layer
3 participants