From xie at yihui.name  Mon Aug 26 04:53:53 2013
From: xie at yihui.name (Yihui Xie)
Date: Sun, 25 Aug 2013 21:53:53 -0500
Subject: [Rd] legitimate use of :::
In-Reply-To: <52178857.5040005@gmail.com>
References: <CANROs4dyoRyjoVHZLs7wDrFrjVX-1zvTTv2i4tBzF3f6Rx-XTA@mail.gmail.com>
	<5215F9BD.5030009@statistik.tu-dortmund.de> <52165F15.1090500@yorku.ca>
	<CABdHhvENvyTD6dPtbQzNaGqgwHNtV86juZh=5F7oBQSPJhO1Rw@mail.gmail.com>
	<BA069179-9E70-4CCE-BD8E-CCB01988B68E@muxspace.com>
	<CAP01uRnuo9kFwbDpmZrQhkF5Mo5EW5LZt623o6b7N7F804Rp0Q@mail.gmail.com>
	<ABEAF14C-9D05-4878-9A15-3FC9728C7951@muxspace.com>
	<521693A6.5030407@statistik.tu-dortmund.de>
	<CAJoaRhZ_fRG2vuUk-dkXa6JwG4zYK2eDDTzw4BXQJFmWxwV92Q@mail.gmail.com>
	<20130823004158.GA14224@gray-ThinkPad-X200-Tablet>
	<CADwqtCMDBcXpziz-_WfMdCtodfeczHySpm7VYyw-zifX8+1ahw@mail.gmail.com>
	<CANROs4eF6TqTpzTyP0nXPWXjR_1O4SG_Vev+yD5oTcYpyc_5CA@mail.gmail.com>
	<52178857.5040005@gmail.com>
Message-ID: <CANROs4fLzMGGzMEDGckNkHSZPGDNi40rJet8FNxhwZXsTuJNFw@mail.gmail.com>

I know it is really bad, but the so-called good approach can be more
expensive than that, primarily because a package with a NOTE in R CMD
check is likely to be rejected by CRAN, or authors have to justify the
NOTE in the email.

For this particular case, I can imagine at least one case which can be
endless trouble to CRAN: if the package author A has talked to B to
use a hidden function in B's package, and B thinks that function is
relatively stable but does not want to export it; A may go ahead and
use it via :::. Both A and B understand that unexported function well,
then what should A do when submitting the package to CRAN? Should CRAN
continue adding rules for such exceptions?

In other words, "bad" practices almost always have exceptions and edge
cases. Of course, the decision is always in CRAN's hands, and I will
try to respect and follow it as a package author.

Regards,
Yihui
--
Yihui Xie <xieyihui at gmail.com>
Web: http://yihui.name
Department of Statistics, Iowa State University
102 Snedecor Hall, Ames, IA


On Fri, Aug 23, 2013 at 11:05 AM, Duncan Murdoch
<murdoch.duncan at gmail.com> wrote:
> On 13-08-22 11:54 PM, Yihui Xie wrote:
>>
>> Maybe it is not a good idea for R CMD check to check ::: at all, and a
>> warning in R-exts and ?':::' may well be enough. On the other hand, it
>> is just so easy to get around :::, because everybody can see its
>> source code:
>
>
> It's a really bad idea to write tricky code to subvert the tests.  If the
> tests are wrong, you can argue for changes (and in this case you did, and
> changes were made), but if you can't give a convincing argument, you should
> follow the good practices that the repository policies enforce.
>
> Duncan Murdoch
>
>>
>>> `:::`
>>
>> function (pkg, name)
>> {
>>      pkg <- as.character(substitute(pkg))
>>      name <- as.character(substitute(name))
>>      get(name, envir = asNamespace(pkg), inherits = FALSE)
>> }
>>
>> Then the package authors who really want to take the risk may start
>> another "hide and seek" game, e.g.
>>
>> `%:::%` = function(pkg, fun) get(fun, envir = asNamespace(pkg),
>> inherits = FALSE)
>> 'stats' %:::% 'Pillai'



[Rd] legitimate use of :::
Yihui Xie