DEV Community

Adolfo Neto
Adolfo Neto

Posted on

Does José Valim prefer dynamic typing or static typing?

I am a member of Elixir em Foco, a podcast about Elixir in Portuguese. We were invited by the organizers of Elixir Brasil 2021 to interview José Valim, the creator of Elixir.

You can watch the video below, if you understand Portuguese:

I asked a question whose answer I would like to share. I am not a professional transcriber or translator, so take that into account when reading the following answer.

Adolfo Neto: Do ​​you particularly prefer statically typed or dynamically typed languages ? If it were just for taste, not for saying what's better or worse for developers.

José Valim: Dynamically typed. I agree a lot with the response from the creators of Erlang. When someone asks "why isn't Erlang statically typed?", a lot of people say it is "because the theory for statically typing everything in Erlang isn't complete yet", which is true, this is one of the points. If we think about types, by definition a type system restricts the amount of software you can write because if you can't prove, using the type system, that a software is correct, even if the code makes sense, if you can't prove, the type system won't accept that software you wrote.
So by definition the type system ends up restricting the developer.
Then people say: "Oh, it's because we couldn't type everything from Erlang".
And they (the creators of Erlang) say no. Robert (Virding) in particular says: "no, it's just that we thought typing wasn't going to solve the problems we had to solve at the time." And here comes the whole Erlang perspective: "Look, there isn't a type system that's going to help you solve problems like 'Oh, what happens if the distributed system's connection goes down, or if something goes down'."
So they said that, instead of thinking at the typing level, they said "look, we want to have a system that is fault tolerant", with that whole idea of ​​fault redundancy. Instead of thinking about typing and trying to catch right away all the problems that can exist, which is impossible in complex systems, they wanted a system that, when a failure happens, the system manages to correct itself. I still think this approach, in general, from a software point of view, it's a more robust approach. Typing can give you that false sense of security that there will be no system errors. But going back a bit, it doesn't mean that I think typing isn't important. It means that I'm with the Erlang people: if you have to choose one of the two, I would choose dynamic typing. But maybe it's best to have both. We don't know yet. Perhaps. But in a choice, which was the question you asked me, I prefer the Erlang choice, I prefer dynamic typing with fault tolerance.

Top comments (2)

binarytemple profile image
Bryan Hunt

Let it crash!

husseinmorsy profile image
Hussein Morsy

Gleam is an interesting beam language, which has static type system. Maybe Elixir can take some ideas from gleam.