Wednesday, October 22, 2008

On static vs. dynamic type systems in programming languages

I'm a "static typed languages" guy. Whose who know me see what I mean :)

The Rail's boys would say it's because I'm frightened by the field of possibilities, the freedom of dynamic languages [1]. I believe that it's more certainly because I came to software development through OCaml, a really good static typed language, and not like a vast majority of developer through languages from the C family (Java the worst among them [2]), which really missed the point of most of the advantages of static typing (yes, one days I will write about how enlightening was my experience with the Coq Proof assistant, and why things like FPH are beautiful)

So, because I'm dealing with Javascript, Pearl, Ruby and Python fan boys quite often (Lisper and Smaltalker are somewhat rarer ;), I would highlight this really good article about static and dynamic type systems, and the fallacies that most programmers believe about statically typed language : http://www.pphsg.org/cdsmith/types.html.

Synopsis:

Fallacies About Static and Dynamic Types

Many programmers approach the question of whether they prefer static or dynamic types by comparing some languages they know that use both techniques. This is a reasonable approach to most questions of preference. The problem, in this case, is that most programmers have limited experience, and haven't tried a lot of languages. For context, here, six or seven doesn't count as "a lot." On top of that, it requires more than a cursory glance to really see the benefit of these two very different styles of programming. Two interesting consequences of this are:

  • Many programmers have used very poor statically typed languages.
  • Many programmers have used dynamically typed languages very poorly.

This section, then, brings up some of the consequences of this limited experience: things many people assume about static or dynamic typing that just ain't so.


And as I clearly fit in the category of "programmers [who] have used dynamically typed languages very poorly", I have to find the same article about fallacies on dynamic type language.
I would really enjoy stuff about run-time optimization, contract on dynamic language, meta-programing [3] and such things.

[1] actually, when I see something like Jquery, I understand that Javascript is somewhat amazing. I will have to look harder on it.
[2] when you reach something like that to get a real static type check for something like an heterogeneous list, then you know that something goes wrong.
[3] it's something that is possible in static typed language,as for example with OCamlP4, but I believe meta-programing in Lisp (for example) is more powerful, and the concept of meta-programing is more spread in dynamic typed language. It may be one of the fallacies ;)

0 comments:

  © Blogger template 'Minimalist G' by Ourblogtemplates.com 2008

Back to TOP