I can't speak to the history per se, but I can give an opinion on the current situation. R is a programming language, as is Python, but R is also a system for interactive data analysis. Outside of the software/package context, library() is almost always sufficient. When it is not, consider "foo <- package::foo". While not as well structured as an importFrom() call, it does make the side effect explicit. When that becomes onerous, it is probably past time to transition to a package.
Michael On Sat, Jul 21, 2018 at 7:54 PM, Aaron Jacobs <ather...@gmail.com> wrote: > Excuse me if this is inappropriate content for this list, but I thought it > might be the best place -- and the best audience -- to ask about a design > decision for the R language. > > Programs or analyses written in R typically use library() to pull in > functions from non-core packages. This differs markedly from most > languages*, which usually offer some way to selectively import symbols. For > example, in Python you'd see "from random import randint", and so on. > > Within R packages, the NAMESPACE file provides this exact functionality > with the importFrom() directive, but the R language itself does not expose > this as a function for regular users. > > I know that R did not have namespaces for some of its early existence, but > I'm curious as to why the language never acquired an import() or > importFrom() replacement for library() when it did get them. Was it purely > for compatibility with S and earlier R versions? Or was there a principled > difference of opinion on how R code should be written at stake? > > Any insight from those of you familiar with R's history would be deeply > appreciated. > > Regards, > Aaron > > ps. I am aware of the very clever "import" package, which provides exactly > this feature -- I am more wondering why such an approach was never adopted > by the language itself. > > * Most languages with real modules/namespaces, I mean. > > [[alternative HTML version deleted]] > > ______________________________________________ > R-devel@r-project.org mailing list > https://stat.ethz.ch/mailman/listinfo/r-devel ______________________________________________ R-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-devel