[Rd] R History: Why is there no importFrom() function?

Aaron Jacobs @theriel @ending from gm@il@com
Sun Jul 22 04:54:33 CEST 2018

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


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]]

More information about the R-devel mailing list