Sets of Programs

As we all know, every programmer makes mistakes. With typesafe languages, a large part of these errors can be detected at compile-time and are therefore easily avoided. For instance, if I have a window manager which is able to maximize windows, and I write code which tells this window manager to maximize the balance of my bank account, the compiler will tell me that a window manager can only maximize windows, but not numbers. So, thanks to typesafety, I could detect the mistake at compile time, instead of creating a program which crashes or shows weird behaviour. That's great!

Now, one might wonder why there are people using dynamic languages, i.e., languages which are not typesafe. As their name suggests, they are more dynamic, which means that there are many things that I can do with dynamic languages, but not with typesafe languages. In other words, there are programs which perfectly make sense, but are not accepted by the compiler of the typesafe language.

This can be visualized by a Venn diagram:

Speaking in terms of this diagram, the aim of every typesafe language should be to make the sets A and B as congruent as possible, i.e., to minimize the size of the areas marked by (2) and (4).

As far as this effort is concerned, I think that

best possible >> Scala > Java > C++

where > means "better than" and >> means "much better than".