Rust versus Go
Today I read Rust vs Go in 2024 and one thing he forgot to mention is R support, haha.
One of the main things he emphasized is that Go has a garbage collector/runtime whereas Rust does not – in fact it uses the same foreign function interface as C. That is probably why R has better support for Rust than for Go.
Rust
Currently there seems to be pretty good support for Rust code in R packages,
- for details about how to write an R package that contains Rust code, read rextendr package vignette. There is some secret sauce in the Makefile.
- to find out how to get your package on CRAN, read CRAN compliant extendr packages.
I believe some CRAN packages use Rust code, not sure which though. I very lightly co-mentored a R-GSOC student polars last year, and so I thought polars may be on CRAN by now, but it is not (Archived on CRAN for policy violations, github says to install from R-universe).
Josiah Perry seems to be a lead rextendr dev, so I thought one of his packages may have Rust and be on CRAN.
- rsgeo was archived for policy violation.
- arcpbf currently has check ERRORs on CRAN, so may be removed soon.
Its DESCRIPTION says “SystemRequirements: Cargo (Rust’s package
manager), rustc” but I don’t have that on this computer, so
install.packages
tells me:
* installing *source* package ‘arcgisutils’ ...
** package ‘arcgisutils’ correctement décompressé et sommes MD5 vérifiées
** using staged installation
checking for rustc... no
----------------------- RUST NOT FOUND---------------------------
The 'rustc' compiler was not found on the PATH. Please install Rust
from: https://www.rust-lang.org/tools/install
Alternatively, you may install Rust from your OS package manager:
- Debian/Ubuntu: apt-get install rustc
- Fedora/CentOS: dnf install rustc
- macOS: brew install rustc
-------------------------------------------------------------------
ERROR: configuration failed for package ‘arcgisutils’
Go
There is an experiment or proof of concept for Go+R under rstats-go on GitHub, but I have not heard of anyone putting Go code on CRAN.