[Rd] LazyLoad changes the class of objects

From: Gabor Grothendieck <ggrothendieck_at_gmail.com>
Date: Fri, 12 Oct 2007 03:04:30 -0400

Consider a package that this DESCRIPTION file:

Package: tester
Version: 0.1-0
Date: 2007-10-12
Title: Prototype object-based programming
Author: Gabor Grothendieck
Maintainer: Gabor Grothendieck <ggrothendieck_at_gmail.com>
Description: test
LazyLoad: true
Depends: R (>= 2.6.0)
License: GPL2

and a single subdirectory R containing tester.R which contains two lines:

e <- new.env()
class(e) <- c("x", "environment")

Now issue these commands:

> library(tester)
> class(tester::e)
[1] "environment"
> R.version.string # Windows Vista
[1] "R version 2.6.0 Patched (2007-10-08 r43124)" Note that the class of e was changed from what we set it to !!! On the other handn, if we omit LazyLoad: true from the DESCRIPTION file then it retains its original class.
> # removed LazyLoad: true line from DESCRIPTION and reinstall pkg
> # now its ok
> library(tester)
> class(tester::e)
[1] "x" "environment" ______________________________________________ R-devel_at_r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-devel
Received on Fri 12 Oct 2007 - 07:07:53 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Thu 25 Oct 2007 - 11:37:10 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-devel. Please read the posting guide before posting to the list.