Bioconductor / BiocGenerics

Defines many S4 generic functions used in Bioconductor
https://bioconductor.org/packages/BiocGenerics
11 stars 7 forks source link

Support glue objects in base-masking functions #10

Closed bersbersbers closed 3 years ago

bersbersbers commented 3 years ago

I have spent ~2 hours today trimming down a large code base to essentially this failing example code:

for (i in seq(2)) {
    message(basename(glue::glue("/some/file")))
    # ...
    suppressPackageStartupMessages(library(BiocGenerics))
    # ...
}

which fails in the second iteration:

file
Error in (function (classes, fdef, mtable)  : 
  unable to find an inherited method for function ‘path’ for signature ‘"glue"’
Calls: fun ... message -> basename -> basename -> path -> <Anonymous>
Execution halted

Life would have been much easier if BiocGenerics functions masking base functions supported at least the same set of inputs:

glue_file <- glue::glue("/some/file")
base::basename(glue_file)         # works
BiocGenerics::basename(glue_file) # fails
hpages commented 3 years ago

Should be fixed in BiocGenerics 0.36.1 (BioC release) and 0.37.2 (BioC devel). Both versions should normally propagate and become available via BiocManager::install() in the next 36 h or so.

Cheers, H.

bersbersbers commented 3 years ago

Thanks!