Skip to content
Prev 56840 / 63424 Next

[R-pkg-devel] Three-argument S3method declaration does not seem to affect dispatching from inside the package.

Hi, Inaki,
On Tue, 2019-05-14 at 12:50 +0200, I?aki Ucar wrote:
I don't think that we disagree about which environment takes
precedence. The issue is whether *within a a given environment*,
registration or function naming should take precedence.
The situation initially arose when I wanted to soft-deprecate calling a
particular method by its full name in order to clean up the package's
namespace.

To use our working example, I wanted calls to gen.formula() to issue a
deprecation warning, but calls to gen(formula) not to. The simplest way
to do that that I could find was to create a function, say,
.gen.formula() that would implement the method and declare it as the S3
export, and modify gen.formula() to issue the warning before passing on
to .gen.formula(). Then, direct calls to gen.formula() would produce a
warning, but gen(formula) would by pass it.
Can you be more specific where the sequence above contradicts the
current implementation (except for swapping 1 and 2)? As far as I can
tell, it's just a more concrete description of what's in the
documentation.

			Best Regards,
			Pavel