Recent and upcoming changes to R-devel
On Jul 6, 2011, at 10:06 AM, Kasper Daniel Hansen wrote:
On Wed, Jul 6, 2011 at 9:42 AM, Duncan Murdoch <murdoch.duncan at gmail.com> wrote:
On 11-07-06 9:25 AM, Kasper Daniel Hansen wrote:
On Mon, Jul 4, 2011 at 8:08 AM, Prof Brian Ripley<ripley at stats.ox.ac.uk> wrote:
In the near future all packages will have a name space. If the sources do not contain one, a default NAMESPACE file will be added. This again will simplify the descriptions and also a lot of internal code. Maintainers of packages without name spaces (currently 42% of CRAN) are encouraged to add one themselves.
This is great. However, it would also be great if a user could disable this for a given package at install time, for example with a command line argument to R CMD INSTALL. Use case: in the early stages of package development I find it incredible useful to not have a NAMESPACE. This is of course before I release it to anyone else; purely for development. My guess is that this has already been anticipated, but in case not, I wanted to raise the issue.
I think the idea is to completely remove support for the bad search order you get when you don't have a namespace. That search order is a mixed blessing in debugging: it makes it easy to replace functions with new versions, but it also makes it very easy to execute the wrong code if you happen to have something sitting in the global environment that has a conflicting name. It seems like something a front end could do to make assignInNamespace easier to use to make working with namespaces easier.
Indeed I find this change to be a very welcome addition to R that will make the life easier for many of us; especially when you are using someone else's package. My use case is also not debugging my own code when it is a at a semi-mature level. I am addressing the very early stages of developing a new package. In my workflow (which may differ from other people's; but I do think a substantial number would agree with me), the early stages of development usually entails bringing order to a number of R scripts; figuring out the structure of the basic objects as well as the arguments for the important functions/methods. In this early stage, almost any evaluation I do at the R prompt is followed by refactoring some part of the code (and then sourcing it into R). Once the code is semi-matured (after the first couple of weeks), I don't think I would mind a NAMESPACE at all, but I believe I would find it very frustrating during the very early development stage (which I am going through right now for one package and which I went through a month ago for another package).
.. but in that case it's easier to just source the package code. That allows much easier and consistent editing as well since you know everything is in the workspace, so you are not dealing with two sets of code. Cheers, Simon