Mental model of languages

“The better decision maker has at his/her disposal repertoires of possible actions; checklists of things to think about before he acts; and he has mechanisms in his mind to evoke these, and bring these to his conscious attention when the situations for decision arise.” 
(Herbert Simon, Nobel Laureate)

C’s mental model is of blocks of memory. C makes you go bare metal – there is a block of memory address blocks underneath!

Python’s underlying mental model is of dicts. Almost everything is a dict or a dict with superpowers!

Erlang’s mental model is of processes. Everything is around handling these processes, monitoring them, how they behave.

LISP’s mental model is of Lists. Everything is a list – function definition, function invocation, data … everything IS A list!

PHP makes you think in terms of HTML output (just kidding).

There is a line I remember – A language that does not fundamentally affect the way you think is not worth learning. Hmmm… time to do some serious work in these languages?

Language vs VM Wars!

Rant follows

Erlang has a weird syntax but again not that far away from being an acquired taste. Python was weird when I started. So was Perl and PHP not so much since. C, C++, Java are all the normal ‘looking’ languages.

These days when I keep coding in Python or PHP, I keep missing the enforced standards of Erlang…

  • first class processes
  • monitoring oriented programming
  • immutable variables
  • first class functions
  • light weight message passing
  • behaviors and OTP

However all of this goes for a toss when I start looking at long term hiring and building a team that can work in Erlang for the long term. And then when I saw Elixir it was neat epiphany. Will there be a time when we will move away from languages and to the Language Virtual Machines.

  • JVM has Java, Groovy, Clojure, Scala and many more
  • BEAM already has Erlang, LFE and Elixir

Now undoubtedly having immutable values gives a huge power to having a pauseless GC and the BEAM is probably better for it. Had the syntax been more “normal” looking, Erlang has many many ideas that definitely need to be heard and learnt by all. It is sad that Erlang does not have the batteries included approach of other languages (I am looking at you Python), but I think where infrastructure and message architecture is involved Erlang is the best bet for now. Except when a class or a struct is involved it is very rare that we try to reuse a variable for more than one purposes. So with some programmer discipline we can ensure that a variable is never used more than once. In that case can the GC of non-Erlang languages be more efficient?

There are so many ifs and buts but it would be nice to see a solid language succeed.