From maechler at stat.math.ethz.ch  Mon Sep 29 11:42:15 2003
From: maechler at stat.math.ethz.ch (Martin Maechler)
Date: Mon Sep 29 10:41:23 2003
Subject: [Rd] infinite recursion during pkg installation w/ methods, setAs
In-Reply-To: <3F774DF0.80906@jhsph.edu>
References: <3F774DF0.80906@jhsph.edu>
Message-ID: <16247.61543.185894.397725@gargle.gargle.HOWL>

>>>>> "Roger" == Roger D Peng <rpeng@jhsph.edu>
>>>>>     on Sun, 28 Sep 2003 17:09:04 -0400 writes:

    Roger> I ran into a problem recently trying to update a
    Roger> package which uses S4 methods using a recent beta of
    Roger> R.  I think I can reproduce it with a simple example.
    Roger> I have package called `testpkg' in directory
    Roger> testpkg/.  In the R/ subdirectory of testpkg/ I have
    Roger> a file called testpkg.R which contains the following
    Roger> two lines:

    Roger> setClass("testpkg", representation(pts = "list"))
    Roger> setAs("testpkg", "numeric", function(from, to) as.numeric(unlist(from)))

Yes, this *is* a problem in recent "R beta" versions.
Doug Bates has reported something very similar to the R core..
So, it should hopefully be resolved "soon".

Thank you very much, Roger, for reporting the problem!
We *are* really very grateful if many people now switch from R
1.7.x to "1.8.0 beta" such that we can catch as many bugs as
possible before release!

Martin

    Roger> Then, in the main testpkg/ directory I have an empty
    Roger> `install.R' file and a dummy DESCRIPTION file (as
    Roger> well as an empty man/ subdirectory).

    Roger> When I run `R CMD INSTALL testpkg' I get the following output:

    Roger> marla:> R CMD INSTALL testpkg
    Roger> * Installing *source* package 'testpkg' ...
    Roger> ** R
    Roger> ** save image
    Roger> [1] "testpkg"
    Roger> Loading required package: testpkg
    Roger> Loading required package: testpkg
    Roger> Loading required package: testpkg
    Roger> Loading required package: testpkg
    Roger> Loading required package: testpkg
    Roger> Loading required package: testpkg
    Roger> Loading required package: testpkg
    Roger> Loading required package: testpkg
    Roger> Loading required package: testpkg
    Roger> Loading required package: testpkg
    Roger> Loading required package: testpkg
    Roger> Error during wrapup: evaluation is nested too deeply: infinite recursion?
    Roger> Loading required package: testpkg
    Roger> Error in options(x) : evaluation is nested too deeply: infinite recursion?
    Roger> Error: evaluation is nested too deeply: infinite recursion?
    Roger> Error: evaluation is nested too deeply: infinite recursion?
    Roger> Error: evaluation is nested too deeply: infinite recursion?
    Roger> Error: evaluation is nested too deeply: infinite recursion?
    Roger> Error: evaluation is nested too deeply: infinite recursion?
    Roger> Error: evaluation is nested too deeply: infinite recursion?
    Roger> Error: evaluation is nested too deeply: infinite recursion?
    Roger> Error: evaluation is nested too deeply: infinite recursion?
    Roger> Error: evaluation is nested too deeply: infinite recursion?
    Roger> Error: evaluation is nested too deeply: infinite recursion?
    Roger> Error: evaluation is nested too deeply: infinite recursion?
    Roger> Error: evaluation is nested too deeply: infinite recursion?
    Roger> Execution halted
    Roger> ERROR: execution of package source for 'testpkg' failed
    Roger> ** Removing '/home/rpeng/install/R-beta/lib/R/library/testpkg'

    Roger> Is this expected?  Did I specify something
    Roger> incorrectly?

    Roger> If I remove the setAs() call, everything installs
    Roger> fine.  Furthermore, if I include a line like:

    Roger> setAs("numeric", "testpkg", function(from, to)
    Roger> list())

    Roger> that doesn't seem to cause a problem.  I only get the
    Roger> infinite recursion problem when the first argument to
    Roger> setAs() is the new class "testpkg".


    >> version
    Roger> _
    Roger> platform i686-pc-linux-gnu
    Roger> arch     i686
    Roger> os       linux-gnu
    Roger> system   i686, linux-gnu
    Roger> status   beta
    Roger> major    1
    Roger> minor    8.0
    Roger> year     2003
    Roger> month    09
    Roger> day      27
    Roger> language R


[Rd] infinite recursion during pkg installation w/ methods, setAs
Martin Maechler