[R-pkg-devel] Removing import(methods) stops exporting S4 "meta name"

Michael Chirico m|ch@e|ch|r|co4 @end|ng |rom gm@||@com
Thu Mar 14 19:34:13 CET 2024


In an effort to streamline our NAMESPACE, we moved from blanket
'import(methods)' to specific importFrom(methods, ....) for the
objects we specifically needed.

Doing so broke a downstream package, however, which has this directive:

importFrom(data.table,`.__T__[:base`)

That package stopped installing after the above change. I can get it
to install again by adding:

importClassesFrom(methods, "[")

to our package, but I'm not sure why this would be necessary. I'm
still left with two questions:

 1. How did we end up with ".__T__[:base" in our exports when we don't
do any S4 around '[' in the package (we do export S3 methods on it)?
 2. Is there any legitimate reason for a package to try and import
such an object? In other words, is breaking this downstream package by
not adding the 'importClassesFrom' workaround the right thing to do? I
don't see any other CRAN packages with a similar directive in its
NAMESPACE.

Michael Chirico



More information about the R-package-devel mailing list