Skip to content

Commit 4e6f563

Browse files
last(?) changes
1 parent faf7a2c commit 4e6f563

File tree

1 file changed

+23
-27
lines changed

1 file changed

+23
-27
lines changed

proposal.Rmd

+23-27
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
title: "ergo: high level interface between R and Go"
33
author: "Romain François"
4-
date: 2018/03/30
4+
date: 2018/03/31
55
output: pdf_document
66
---
77

@@ -13,20 +13,20 @@ knitr::opts_chunk$set(echo = TRUE)
1313

1414
R is an amazing interpreted language, giving a flexible and agile foundation for Data Science.
1515
Efforts such as Rcpp and reticulate have established that it can be an advantage
16-
to pair R with another programming language. Sometimes for speed, but most importantly
17-
to have alternative options of expression.
16+
to pair R with another programming language. Sometimes for speed, sometimes to
17+
have alternative options of expression, sometimes to have access to existing
18+
libraries.
1819

19-
> Maybe mention that we sometimes want to use existing implementations?
20-
21-
[Go](https://golang.org) is an open source programming language that makes it easy to
20+
Go (`https://golang.org`) is an open source programming language that makes it easy to
2221
build simple, reliable and efficient software. It is sometimes said to be the language
2322
C++ should have been, in particular if it did not carry a strong commitment to backwards
2423
compatibility to C and a taste for complexity.
2524

2625
Go is beautiful and simple, its standard library is one of the most impressive
2726
for a programming language. It comes with concurrency built in, which includes
2827
(but is not limited to) running code in parallel. The static site generator [hugo](https://gohugo.io),
29-
the containerization plaform [docker](https://www.docker.com/), and the profiling utility [pprof](https://github.com/google/pprof) are examples
28+
the containerization plaform [docker](https://www.docker.com/), and the profiling
29+
utility [pprof](https://github.com/google/pprof) are examples
3030
of systems that are built with Go.
3131

3232
There currently is no end to end solution to easily connect R and Go, i.e. invoke Go code
@@ -38,28 +38,22 @@ interesting avenues for R package development.
3838

3939
## Rcpp
4040

41-
The Rcpp package by Eddelbuettel and François is the current state of the practice to connect C++ code with R, used by over 1300 CRAN packages.
42-
With Rcpp it is very easy to make a C++ function callable from R: mark the function with [attributes](https://cran.r-project.org/web/packages/Rcpp/vignettes/Rcpp-attributes.pdf), and Rcpp generates the glue code that takes care of converting input and output data and propagating errors.
43-
Rcpp offers the `Vector` class, with specializations like `IntegerVector`, `CharacterVector`, and `List`, that allow accessing R data structures in a way idiomatic to C++.
44-
Rcpp sugar supports writing C++ code that almost looks like R code but implements the operations internally without roundtripping to R.
41+
The Rcpp package (`https://github.com/RcppCore/Rcpp`) is the current state of the practice to connect C++ code with R,
42+
used by over 1300 CRAN packages. With Rcpp it is very easy to make a C++ function callable from R: mark the function with [attributes](https://cran.r-project.org/web/packages/Rcpp/vignettes/Rcpp-attributes.pdf), and Rcpp generates the glue code that takes care of converting input and output data and propagating errors.
43+
Rcpp offers classes such as `NumericVector`, and `List`,
44+
that allow accessing most R data structures in a way idiomatic to C++.
4545

4646
## rmq
4747

48-
The rmq package (https://github.com/glycerine/rmq) by Jason E. Aten is scoped
48+
The rmq package (`https://github.com/glycerine/rmq`) is scoped
4949
as a proof of concept to embed a Go library in an R package.
5050
The code uses msgpack, a serialization protocol, to pass data between R and Go,
5151
and implements a client-server system using websockets.
52-
According to the author, the project is finished.
53-
Unfortunately, installation of this package requires tweaking the code, so far I
54-
was unable to install the package and test the code on OS X and Ubuntu.
55-
5652

5753
## r-go proof of concept
5854

59-
Independently of rmq, I have written four blog posts at
60-
https://purrple.cat/tags/go/ that describe how to
61-
embed a Go library in an R package so that it is compiled when
62-
the R package is installed.
55+
Independently of rmq, I have written a series of blog posts at `https://purrple.cat/tags/go/` that describe how to
56+
embed Go code in an R package so that it is compiled when the R package is installed.
6357
I show how to call functions in the library and how to pass data to and from Go.
6458
Even though the code in the blog posts has been written manually, it is explicitely
6559
divided in two different categories:
@@ -77,14 +71,14 @@ As opposed to `Rcpp` which is a dependency in all stages (development, build, r
7771
code to interface R and Go via their respective C apis. From the point of view of the user of `ergo`,
7872
the workflow will be:
7973

80-
- Write code in idiomatic Go
74+
- Write code in idiomatic Go somewhere standard in the package
8175
- Generate boiler plate (Go, R, C) with functions from `ergo`
82-
- Call that code from R
76+
- Call that code from R functions of the package
8377

8478
The role of `ergo` is to hide the C layer entirely, so that users can focus on writing Go and R code.
85-
In a way, this is similar to the feature of
86-
Rcpp attributes,
87-
but it goes further. Once `ergo` has generated the code, the target package is autonomous.
79+
In a way, this is similar to the feature of Rcpp attributes,
80+
but it goes further. Once `ergo` has generated the code, the target package is autonomous. This gives
81+
more control to the package authors and eliminate a set of issues related to dependency.
8882

8983
## First iteration
9084

@@ -131,11 +125,13 @@ to imagine the importance of Rcpp when it was first developed.
131125

132126
## About the author
133127

128+
I have more than 12 years professional experience with R and a strong commitment
129+
to open source development.
130+
134131
I am a co-author of Rcpp that now has more than 1000 downstream dependencies,
135132
the experience of having written Rcpp is extremely valuable in the pursuit of this project.
133+
136134
Curiosity about Go led me to incept this project in the summer of 2017.
137-
I have more than 12 years professional experience with R and a strong commitment
138-
to open source development.
139135

140136
## Commitment
141137

0 commit comments

Comments
 (0)