5
$\begingroup$

I have varying levels of experience with Matlab, Mathematica, R, Octave, Python (SciPy) and Julia for statistical/numerical programming. These are all dynamically typed languages and are not compiled (if we ignore JIT compilation). While it is quick and easy to write code in these languages, and some (notably Mathematica) are incredibly powerful, code written in such languages can be brittle to programming errors that can be detected at compile time in statically typed (compiled) languages, and to API changes.

Having just been bitten by the latter in some R code I'd written only a year ago (minor changes in the ggplot2 API), I can really see the value in the static and compiled approach.

But unless I'm overlooking something obvious, there are no modern high level languages for statistical computing that are also statically typed and compiled. I wouldn't count C/C++/FORTRAN among them. (Perhaps Java or Scala via a good set of libraries?)

So, are there statically typed, compiled languages that are particularly good for statistical computing (either in and of themselves, or via a particularly good library)?

Thanks.

$\endgroup$
6
  • 2
    $\begingroup$ How would using a static/compiled language save you from an API change? $\endgroup$
    – Hong Ooi
    Commented Jul 19, 2013 at 2:05
  • $\begingroup$ Also you're going to increase the programming time at every level of your analysis. Its hard to imagine that the outweighs the task of checking for bugs in your plotting functions or the benefits of performing an interactive analysis. Do you care to elaborate on your needs? $\endgroup$
    – agconti
    Commented Jul 19, 2013 at 3:28
  • 1
    $\begingroup$ Being able to compile and get a binary would allow one to easily rerun analyses on existing data to reproduce results (modulo dramatic OS-level changes), or analyse new data with “old” code. This is technically possible with dynamic languages but requires significant engineering effort to be vigilant to changes to language- or library-defined methods, and to changes in library APIs. $\endgroup$
    – Chris
    Commented Jul 19, 2013 at 8:26
  • $\begingroup$ In terms of programmer time, some analyses are only ever run once, and are essentially throw-away pieces of code. Others may be “infrastructure analyses” that are run frequently over long periods of time. My situation is somewhere between these extremes, in that analyses need to be run once or so each year, but there is a requirement to be able to regenerate old results in case of audit. Perhaps wrapping everything up in a virtual machine image would be the way to go, but I don't know how stable the underlying VM image file formats are between successive versions of the VM software. $\endgroup$
    – Chris
    Commented Jul 19, 2013 at 8:34
  • 1
    $\begingroup$ @Chris You can have as many installations of R as you want on a machine (and many package libraries per installation), so you can always keep the original environment. It is worth noting that you can still compile code that returns complete garbage, which is where testing comes in... $\endgroup$
    – James
    Commented Jul 22, 2013 at 16:43

1 Answer 1

4
$\begingroup$

In Julia the types are optional but you can choose to code with them and you get the checks you want.

I prefer to code that way eve though you have the option to not declare types.

I do the same in R with the relatively new reference class objects. I declare types there too.

$\endgroup$
1
  • 1
    $\begingroup$ Thanks. I wasn't aware of this facility in R. Julia is increasingly attractive. $\endgroup$
    – Chris
    Commented Jul 19, 2013 at 8:36

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.