-
Notifications
You must be signed in to change notification settings - Fork 186
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
Is isS3stdGeneric()
the right way to detect S3 generics?
#846
Comments
The manual seems pretty clear about the intent of the function:
That said, the body of
Something like "the final expression of the body is When implementing, this would be another case where https://github.com/jimhester/lintr/blob/master/.dev/compare_branches.R will come in handy to make sure we're not introducing any false positives by mistake. |
Just played around a little bit:
Does the trick for While at it, maybe it would be more useful to analyze if there is any call to |
When checking if a function is an S3 generic (after getting it from the
NAMESPACE
file for example), a call toisS3stdGeneric()
is used to tell if the function is an S3 generic. This works well for standard generics (when the first expression in the body callsUseMethod()
[1]), but doesn't work so well if there is any sort of pre-processing in the generic (e.g.vctrs::vec_ptype_full
which runs some dots checking before callingUseMethod
)I've looked a bit and haven't yet found a function that will find both standard and non-standard S3 generics. Would it be better / ok to fall back to the prior check of
is.function(fun)
? Or have an option to do that?[1] - https://stat.ethz.ch/R-manual/R-devel/library/utils/html/isS3stdGen.html
The text was updated successfully, but these errors were encountered: