[Rd] S4 class name conflicts

Gábor Csárdi c@@rd|@g@bor @end|ng |rom gm@||@com
Tue Feb 8 15:15:05 CET 2022


The RNeXML CRAN package currently has some check warnings, originating
from an S4 class name conflict.

RNeXML sets the S4 class "tree". A dependency of the package now
depends on the cli package, which calls setOldClass() on an S3 "tree"
class.

This causes two potential issues. One is that RNeXML maybe ends up
using cli's class internally, because this is what we see at install
time:

** byte-compile and prepare package for lazy loading
Found more than one class "tree" in cache; using the first, from namespace 'cli'
Also defined by ‘RNeXML’

The second issue is an error when RNeXML is unloaded:

❯ unloadNamespace("RNeXML")
Error in .mergeMethodsTable(generic, mtable, tt, attach) :
  trying to get slot "defined" from an object of a basic class
("environment") with no slots

This makes R CMD check fail as well.

Is cli doing something wrong here? Or is this a bug in base R? Or is
it a known limitation? If the latter, would it make sense for the
RNeXML installation to fail instead of creating a broken package. (If
it is a broken package at all.)

Gabor



More information about the R-devel mailing list