Finding the right tool for the job - FAIL

vr 18 oktober 2013

Filed under Blog

I need to pick a programming language to prototype some initial ideas for my next research project, an interactive shell to program and control lightweight process networks. I initially started with Python, but I stumbled into the need for efficient and concise pattern matching on tree-like data structures, which Python does not provide. So I started to search for a replacement, scanning my usual go-to languages: Go, C++, ML, Haskell, shell scripts.

To my surprise, for my specific pet project none of them fit my bill of requirements:

  • [match] supports structural pattern matching (fails: C++, Python, shell)
  • [gen] can express generic functions (fails: Go)
  • [dbg] supports “printf”-style debugging (fails: Haskell)
  • [syn] the syntax is concise and does not sacrifice clarity for pedantism (fails: ML, Go)

Then I scanned a few more candidates which I intended to learn/use soon anyways: Scheme (Racket, Chicken), Rust, Shen, Erlang, Clojure. Unfortunately those fail other more important requirements, which the previous 4 languages did match already:

  • [bus] high bus factor (fails: Shen, Chicken)
  • [proc] supports process creation and inter-process communication out-of-the-box (fails: Shen)
  • [conc] supports lightweight and composable concurrency out-of-the-box (fails: Shen, Lua)
  • [ffi] provides a comprehensive and simple foreign function interface to C libraries (fails: Erlang, Shen)
  • [light] is close to running embedded: small implementations exist and/or run-time OS dependencies are clearly specified (fail: Racket, Erlang)
  • [stable] stable language definition (fails: Shen, Rust)

This was intruiging. Then I started to scan further and larger, to other languages I looked at previously, and still no luck.

Here’s a summary table. The requirements (left to right) are listed in decreasing order of importance for my project. They are all somewhat “deal breakers” for now.

Language [bus] [proc] [conc] [ffi] [light] [stable] [match] [gen] [dbg] [syn]
ML (OCaml)                   N
Haskell                 N  
Go               N   N
Python             N      
Unix shell             N      
Rust           N        
Scheme/Racket         N          
Common LISP         N          
Scheme/Guile         N          
D         N   N      
Clojure       N N   ?      
Erlang       N N          
Perl     N   N          
C     N       N N    
C++     N       N     N
Javascript   N   N     N      
Java   N   N N   N      
Scheme/Chicken N                  
Lua N   N       N      
Shen N N N N   N        

What I learned from this:

  1. I would be happier if the Rust team would get its sh*t together and stabilize the language.
  2. It’s a shame that the main author of Chicken is slowly walking away from the implementation and nobody is seriously picking it up yet.
  3. Maybe it is time for me to learn CamlP4 and add some simplified syntax to Ocaml.
  4. It’s also a shame that Haskell was not designed by system programmers for system programmers.
  5. The Python community should learn more from functional language designers.
  6. I dread the prospect of implementing my own programming language but this project might leave me no choice.


Raphael's scientific home page © Raphael ‘kena’ Poss. Powered by Pelican and Twitter Bootstrap. Icons by Font Awesome.