[R-package] make finalize() in R6 classes private #6833
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
From the
{R6}
docs:ref: https://r6.r-lib.org/articles/Introduction.html
Given that last statement ("... and finally, it will no longer support public finalizers"), I think
{lightgbm}
's R6 finalizers should be moved to private methods.This proposes:
finalize()
methods on R6 classes privateR6 (>= 2.4.0)
to make that safeNotes for Reviewers
{R6}
2.4.0 was released 6 years ago, in February 2019: https://github.com/r-lib/R6/releases/tag/v2.4.0So this new floor of
>= 2.4.0
should not cause much disruption.However, still marking this PR as
breaking
because it removes a public method from the R6 classes in{lightgbm}
. Those are not exported, but they're technically still part of the public API because they can be returned by exported functions (e.g.lgb.train()
returns aBooster
).