G'day Brian, On Fri, 20 Feb 2009 11:37:18 +0000 (GMT) Prof Brian Ripley <rip...@stats.ox.ac.uk> wrote:
> This was rather a large shift of subject, [...] Well, yes, from the clean unloading of compiled code to the clean unloading of R code. :-) Though, I also confirmed that the former is possible on a cooperative OS when library.dynam.unload() is correctly used via an .onUnload() hook. > Is lazy loading involved? Yes, the DESCRIPTION file has the default "LazyLoad: yes" entry. If I set "LazyLoad: no", then both sequences use the new version of the R code immediately. > If so I have an idea that may or may not be relevant. We do cache in > memory the lazy-loading database for speed on slow (network-mounted > or USB drive) file systems. Now the cache is flushed at least if you > do detach(foo, unload = TRUE) or but I can envisage a set of > circumstances in which it might not be. As far as I can tell, "detach(foo, unload=TRUE)" and "unloadNamespace(foo)" behave identical on my machines (while the DESCRIPTION file has "LazyLoad: yes"); the modified R code is only used if either of this command is given (followed by "library(foo)") after the new version of the package was installed. > So perhaps try detach(foo, unload = TRUE) or not using lazy-loading > when developing the package? Unfortunately, the former does not work and although the latter works I am hesitant to use it since: a) as I understand it, most packages that use S4 methods need lazy-loading (though the particular package with which I noticed the behaviour does not have S4 methods); and b) it seems that these days the DESCRIPTION file is the only way of switching lazy loading on and off and that there is no way of overriding that value. Knowing myself, I would forget changing the DESCRIPTION file back to "LazyLoad: yes" before building the .tar.gz file for distribution (once the package is ready). As it is, I have already to remember to take "-Wall -pedantic" out of the Makevars file in the src/ directory; but I am reminded of that by R CMD check. Well, thinking a bit more about b), I could probably complicate my Makefile a bit more such that a "make install" first modifies the DESCRIPTION file to "LazyLoad: no" before installing the package to the local library and that "make build" first modifies the DESCRIPTION in the opposite way. But this would still leave concern a). Cheers, Berwin ______________________________________________ R-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-devel