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

Inconsistency when referring to a function programmatically #26

Open
jonthegeek opened this issue Jul 22, 2020 · 0 comments
Open

Inconsistency when referring to a function programmatically #26

jonthegeek opened this issue Jul 22, 2020 · 0 comments
Labels
bug an unexpected problem or unintended behavior

Comments

@jonthegeek
Copy link

If I refer to a function via a variable, the class column of s3_methods_generic isn't what I'd expect.

this_func <- mean
sloop::s3_methods_generic("this_func")
#> Warning in .S3methods(generic.function, class, envir): generic function
#> 'this_func' dispatches methods for generic 'mean'
#> # A tibble: 6 x 4
#>   generic class         visible source                      
#>   <chr>   <chr>         <lgl>   <chr>                       
#> 1 mean    mean.Date     TRUE    base                        
#> 2 mean    mean.default  TRUE    base                        
#> 3 mean    mean.difftime TRUE    base                        
#> 4 mean    mean.POSIXct  TRUE    base                        
#> 5 mean    mean.POSIXlt  TRUE    base                        
#> 6 mean    mean.quosure  FALSE   registered S3method for mean
sloop::s3_methods_generic("mean")
#> # A tibble: 7 x 4
#>   generic class      visible source             
#>   <chr>   <chr>      <lgl>   <chr>              
#> 1 mean    Date       TRUE    base               
#> 2 mean    default    TRUE    base               
#> 3 mean    difftime   TRUE    base               
#> 4 mean    POSIXct    TRUE    base               
#> 5 mean    POSIXlt    TRUE    base               
#> 6 mean    quosure    FALSE   registered S3method
#> 7 mean    vctrs_vctr FALSE   registered S3method

We already have the "generic" column from utils::method, should it use that for generating the "class" column (rather than x)?

I can PR if there isn't a reason to use the generic_esc that I'm not thinking of; using info from methods seems safer.

@hadley hadley added the bug an unexpected problem or unintended behavior label Oct 30, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug an unexpected problem or unintended behavior
Projects
None yet
Development

No branches or pull requests

2 participants