ops64 dispatch with both arguments having classes #249
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.
The default S3 dispatch on the Ops group for two arguments having class attributes results in a dispatch of the default method with a warning. Since R 4.3.0 one can use
chooseOpsMethodto handle that situation by signaling which method of the two classes should be dispatched to.Since
difftime * integer64orinteger64 * difftimeshould returndifftimeI use the helpertarget_class_for_Ops()to determine whether to returninteger64or not. Everytime when ainteger64argument is paired with alogical, (plain)integer,integer64, or (plain)doubleargumentinteger64is returned. Otherwise theinteger64argument is coerced todoubleand the method of the class of the other argument (or default) is called.I moved all the methods of the Ops group into a new file ops64.R with a corresponding man page.
I figured out, that an explicit handling of
xoris not necessary, since the default functions (either base or bit) work and have a consistent result with base R.I added tests for a consistent behaviour of R for the data types
logical,integer,double,complex,Date,POSIXct,POSIXlt, anddifftimefor all Ops operators includingxor.(During testing I found #248.)
Closes #179