[Rd] Infinite recursion in getGeneric (PR#4561)
jmc at research.bell-labs.com
Mon Oct 13 22:17:46 MEST 2003
saikat at stat.wisc.edu wrote:
> > setClass('foo')
>  "foo"
> > setMethod('is.logical', 'foo', function(x) TRUE)
>  "is.logical"
> > getGeneric('is.integer')
> Error in options(x) : evaluation is nested too deeply: infinite
This is one of a number of potential problems when methods are specified
for primitive functions used in the R code that dispatches methods.
There is a fix for this particular example -- I will commit it to
However, the only real safety will come when primitives are not
dispatched from a global structure (a change planned for 1.9). Then the
version of primitives used in method dispatch can be separated from any
methods defined in a different namespace.
For example, a quick test showed that even after the above fix, setting
methods for "is.null" causes similar problems.
As a heuristic, setting methods for language-related primitives is
dangerous (also a little strange?).
> --please do not edit the information below--
> platform = i686-pc-linux-gnu
> arch = i686
> os = linux-gnu
> system = i686, linux-gnu
> status =
> major = 1
> minor = 8.0
> year = 2003
> month = 10
> day = 08
> language = R
> Search Path:
> .GlobalEnv, package:methods, package:ctest, package:mva,
> package:modreg, package:nls, package:ts, Autoloads, package:base
> R-devel at stat.math.ethz.ch mailing list
John M. Chambers jmc at bell-labs.com
Bell Labs, Lucent Technologies office: (908)582-2681
700 Mountain Avenue, Room 2C-282 fax: (908)582-3340
Murray Hill, NJ 07974 web: http://www.cs.bell-labs.com/~jmc
More information about the R-devel