February 11, 2019
This week version 2.0 of the V8 package has been released to CRAN. Go get it now!
Porting the R package to support recent V8 engines was not easy. The V8 maintainers have the bad habit of changing the API all the time, so the Linux distributions don’t like to ship and upgrade libv8. CRAN requires that R packages will work on Windows, MacOS, Fedora, Debian, and Solaris, and for a long time it seemed impossible to upgrade the R package while keeping it working on all systems.
Things changed a few weeks ago when Debian announced libv8 would be removed in the upcoming Debian Buster, and instead a new package libnode-dev would be added which contains the V8 build that is included with NodeJS 10.15. This will allow to us to install the R package on Debian 10 (Buster) and Ubuntu 19.04 (Disco) and take advantage of Node’s embedded V8 engine.
I got surprised by this myself in the jsonld package. It turned out most functions in the jsonld.js library return a promise instead of the actual results, but I never realized this because the old V8 did not support promises. To make things work with the new V8, I changed the R wrappers to store results via callback functions.
If you write R packages with JS bindings, note that some Linux systems will still be running the legacy 3.14 engine for now. Hence to release the package on CRAN, you still need to use a fallback polyfill or transpile your modern JS to traditional JS something like babel.js to support legacy ES5 engines.