Skip to content
Prev 2927 / 12125 Next

[R-pkg-devel] More on explosive dependencies

El lun., 16 jul. 2018 a las 3:24, Lenth, Russell V
(<russell-lenth at uiowa.edu>) escribi?:
Is it *official* that the export() workaround won't work in future R
versions? I'm using this in at least one package and it's not failing
on those platforms.
There is, actually: *dynamic registration*. It's based on calling
registerS3method when the other package is loaded. This is done by
calling setHook (in this case, on the multcomp "onLoad" event) from
your package's .onLoad function. See the mechanism here:

- Call register_s3_method in .onLoad if requireNamespace returns true
(the package is available):
https://github.com/tidyverse/googledrive/blob/master/R/aaa.R#L45
- The definition of register_s3_method, which calls registerS3method:
https://github.com/tidyverse/googledrive/blob/master/R/dplyr-compat.R#L5

It seems that this mechanism will be added to roxygen2, according to
https://github.com/klutometis/roxygen/issues/623, to avoid copying
this code over from package to package.

I?aki
Message-ID: <CALEXWq1XDm6pLkCoNk5qpcD2k3T6a3KZyf_7YKyeTp6cR69VWQ@mail.gmail.com>
In-Reply-To: <DM6PR04MB4380DC9BAF4A50497A673B6EF15D0@DM6PR04MB4380.namprd04.prod.outlook.com>