From maechler at stat.math.ethz.ch  Mon Sep  3 17:18:43 2012
From: maechler at stat.math.ethz.ch (Martin Maechler)
Date: Mon, 3 Sep 2012 17:18:43 +0200
Subject: [Rd] if(--as-cran)?
In-Reply-To: <20548.49118.496081.738932@max.nulle.part>
References: <50444374.50709@prodsyse.com>
	<CAFDcVCTF9xCqpo-1rUiKaooHf43-V_zfkUOi2k+0jzogW+xNXQ@mail.gmail.com>
	<20548.49118.496081.738932@max.nulle.part>
Message-ID: <20548.51795.593805.264617@stat.math.ethz.ch>

>>>>> Dirk Eddelbuettel <edd at debian.org>
>>>>>     on Mon, 3 Sep 2012 09:34:06 -0500 writes:

    > On 3 September 2012 at 00:49, Henrik Bengtsson wrote:
    > | Hi, see thread "[Rd] Proposal: Mechanism for controlling the amount of
    > | testing 'R CMD check' performs" on April 8, 2012:
    > | 
    > |   https://stat.ethz.ch/pipermail/r-devel/2012-April/063809.html

    > Good proposal, somehow I missed that at the time.
    > Something like this ought be to implemented in R proper.

I agree.... but the CRAN maintainers have to agree too.


    > In Rcpp, I am now using a similar
    > environment-variable-based approach, and it doesn't scale
    > particularly well if every (large) package does its own thing.

yes, my packages do their own thing too, now, e.g., Matrix
(not yet released):

doExtras <- interactive() || nzchar(Sys.getenv("R_MATRIX_CHECK_EXTRA")) ||
    identical("true", unname(Sys.getenv("R_PKG_CHECKING_doExtras")))

and then I use  if(doExtras) { .... }
but I agree with Henrik that it would make sense to have more
than just two levels for the amount of testing, not just for CRAN.

An additional, slightly more interesting feature request that
you may also want in these cases, is the following:
Assume, that we have a function testingLevel()
and the following code should only be run, if the testing level
is 2 or higher

if(testingLevel() > 2) {
 .......1
 .......2
 ........
 ........
 .......n
}

Now what we all really wanted was that the ........ code
ran just as in toplevel.
While I think that's almost impossible,
as the .....1 to .....n must first be parsed all, and then
evaluated (which is already different from top level),
I would at least want that  the auto-printing worked like in
toplevel, so I don't have to write a  print(.) around every
......i that would autoprint if in toplevel, and of course does
*not* autoprint inside if(.) { .. }.

Martin Maechler, ETH Zurich

    > Dirk
 
    > | /Henrik

    > -- 
    > Dirk Eddelbuettel | edd at debian.org | http://dirk.eddelbuettel.com



[Rd] if(--as-cran)?
Martin Maechler