-
Notifications
You must be signed in to change notification settings - Fork 31
Description
Hi, I did my whole PhD doing mostly R and stopped using it then. I authored a few packages, and am the maintainer of the R kernel for Jupyter.
I think you overlooked the number 1 reason why R probably won’t become a serious programming language:
Its packages have two flat namespaces (pkg:::internal and pkg::exported).
That means that
-
Writing packages will leave you in a symbol jungle of your own creation. All your packages’ files are essentially be concatenated and evaluated in the internal namespace (with access to things you imported in the NAMESPACE file).
This means you’ll never build bigger, more complex packages that aren’t a complete mess. If you want clean, complex functionality, you’ll have to maintain several smaller packages, which is a high burden for individuals. In contrast, Python’s subpackages solve this effortlessly.
-
Many useful packages are designed to be
library()d, not having their items accessed via::. This means 2. is very hard to fix, even if there was interest do do so: If you e.g. havepkg1define a genericgen <- ...; setGeneric('gen')andpkg2defines bothCls <- setClass('Cls')andsetMethod('gen', 'Cls'), you can‘t just dopkg1::gen(pkg2::Cls(...)), since the method isn’t in a visible namespace. This was S4, but S3 has the same problem (and others).
I think CRAN’s more vetted package publishing process (compared to PyPI’s), combined with Python’s namespace system would be ideal. But given the choice, Python is just the better language for building things.
PS: the extremely implicit and underdocumented package building process is also an R problem. Python fixed its own packaging mess by replacing their system. In R, you still have a giant pile of possible files and variables that modify how your package is built, especially if you use Rcpp or so.