Thursday, February 23, 2012

My Dream Programming Language

We all have a set of favourite language features and ideals we pick up over programming time.  We of course think there’s some magic mix of them that would suit all the programming tasks to which we turn.

My recipe would be:

  • is fast enough that I don’t need to turn to C++ on my projects.  I’ve tried cython and its a bit messy.  I want very near the speed of C++ and am prepared to concede language ideals to make that possible
  • statically typed and strongly typed; the boxing in dynamic languages are a crazy performance problem but the biggest downside is runtime errors
  • yet dynamic when you explicitly say so (perhaps via prefix on the variable name); if you want to open the rabbit-hole of prototype-based classes you can.  Steve Yegge calls it the other way around, but I put safety first; I find it saves time
  • implicitly typed; the compiler should spot the types, coercions and implicit generics.  Haxe is very good at this; I’m not an OCaml user but I hear they have this too
  • re-typed; static single type assignment
  • instance declaration syntax - the duality of dictionaries and class instances and the ability to declare instances without classes like Javascript
  • anonymous functions
  • constness; defensive programmers should be able to declare a variable to be const from some point onwards in the parsing
  • default values; if I don’t initialise a member, it should have a well-defined default value (of 0)
  • nullable variables; the compiler should be clever enough to put guards on possibly nullable references and such when necessary
  • Python-style intrinsic collections and iteration and membership testing; but with additional built-in collections such as a variety of trees
  • Garbage-collected
  • STM and clojure-like concurrency
  • message-passing actor-like concurrency
  • No explicit threading but a proper preemptive multi-tasking hidden in the runtime; no global variables but singletons and handlers (so that the callbacks of singletons and handlers happen in their thread giving guaranteed ordering)
  • Python indentation
  • Web-serving and database-talking batteries included; not a platform where there are lots of third party frameworks but rather one where the very best performing framework is the natural choice and part of the platform
  • a system-level caching system

The common theme here is on correctness.  First sight correctness.  C++/Java without the boilerplate.

Basically, a less-restricted Python-like :)  The beauty and conciseness of readability of Python with a model more like Go.  Something you can use for systems programming, and for quick scripting.

Clojure and Go are two languages that have really piqued my interest.  They both fail simply because I find Python so much more pleasing on the eyes.  If only Clojure wasn’t dynamic and had fewer parenthesis.  I have a real job seeing past them and appreciating Lisp :)  Go, again, like Lua, has just too many block terminators where Python needs none.  Yeah significant whitespace rules!

Update: I had not imagined this post being popular nor was I really eliciting programming language recommendations yet both happened.  I was particularly taken with the recommendations of tart and rust.  Tart, despite its first motivation to combine “the simplicity and readability of Python” with a systems language, is firmly in the curly brackets camp.  Rust, too, is a curly brackets language.  Both are well worth investigating; I will try to use each and get a stronger feel for them.  Certainly reading about Rust and its task concept really excites me.  On the other hand, the recommendation of Haskell - a language I have tried to objectively learn a couple of aborted times - was a bit harder for me; Haskell readability really demands a new blog post :)

If you liked this, you may like: Cogs Bad

(Posted to reddit)


  1. williamedwardscoder posted this

 ↓ click the "share" button below!