the Problems
Wed, Oct 21, 2015I like programming languages, so I was thinking about what I would want in my favorite one.
Here are the basic essentials for a language to have a chance at being my favorite:
- Strict Type Checking
- No Nil Pointer
- Green Threads with both go-like channels and mutexes.
- Compiles to binary, without a virtual machine.
- Still runs on all platforms that I care about.
- Parametric Polymorphism
- Methods with dot syntax
- Fast compilation, fast running
- Lisp- or scheme-style macros of some sort
- User specified Operators with precedence
- Mutation
- A clean syntax (I’m aware how subjective this is)
Okay! Let’s see how languages do:
Go
Fails on: 2,6,9,10
Nil pointers are annoying but not a dealbreaker. Lack of polymorphism is where it falls apart.
Python
Fails on: 1,2,3,4,8,9,10
Too many to talk about.
C++
Fails on: 2,3,8,9,10,12
Java
Fails on: 2,4,9,10,12
Haskell
Fails on: 7,9,11
Easily the best so far, but that lack of mutation is a killer. State is so useful sometimes. You’ll notice it’s the only one that passes 10, and the only one that fails 11.
Rust
Fails on: 3,10,12
The lack of green threads is unfortunate, and damn is it ugly, but other than that rust is a great contender.
Edit
Revisiting this post, I see that OCaml wasn’t mentioned!
OCaml
Fails on: 7
Damn. I didn’t even know about OCaml!