Try registering a chooseOpsMethod()
for a stepper
#101
+14
−0
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.
CC @hadley @t-kalinowski @ltierney - This is an example of testing out
chooseOpsMethod()
to prove that it works as expected. And it looks good to me!I think we will actually end up registering
chooseOpsMethod.vctrs_vctr()
, which will handle it correctly for all vctrs subclasses, like this almanac stepper. So I won't end up merging this.The only problem that can come up is if both classes register a
chooseOpsMethod()
method with conflictingmx
andmy
methods, like what I do below by registering a method for<Date>
. That can result in silent weird results, which is a little scary, but I still think this feature is a big improvement.Before (R 4.2):
After (r-devel):
Created on 2023-04-19 with reprex v2.0.2