sundi

sundi

Podcast: Elixir Wizards Podcast - Interview with José, Guillaume, & Giuseppe - [S10E12]

It’s the Season 10 finale of the Elixir Wizards podcast! José Valim, Guillaume Duboc, and Giuseppe Castagna join Wizards Owen Bickford and Dan Ivovich to dive into the prospect of types in the Elixir programming language! They break down their research on set-theoretical typing and highlight their goal of creating a type system that supports as many Elixir idioms as possible while balancing simplicity and pragmatism.

José Valim, Guillaume Duboc, and Giuseppe Castagna on the Future of Types in Elixir

Most Liked

josevalim

josevalim

Creator of Elixir

Great link. Let’s break it down.

First of all, what is a gradual type system? A gradual type system is achieved by getting a static type system and adding the “dynamic” type to it. In other words, in a gradual type system, if you don’t use the dynamic type, you should be able to reap all benefits of a static type system.

So are gradual type systems more complex? Not in theory. But in practice, as they are applied to dynamic programming languages, type systems end-up being more complex because dynamic programming languages are more expressive. A static language, without gradual types, that wishes to incorporate all expressive power found in dynamic languages would end-up equally complex!

This is one of the points I mentioned in my keynote: often type systems are used to restrict the power of a programming language. However, do we really want to restrict the power of Elixir and Erlang? No, we don’t. Therefore I don’t agree with the implied causation from Richard’s talk. Even if Elixir was statically typed from day one, it would have a complex type system because we want all of the expressive power it offers.

The complexity of a type system therefore depends on the expressiveness and the guarantees it wants to provide. It is likely that the Rust type system is more complex than the one we are working on for Elixir, but it does provide a different set of guarantees and expressiveness.

Another point from the discussion is that gradually typed languages have reduced runtime performance but that doesn’t have to be the case. Remember, if you use a gradual type system, but not the dynamic type, it should behave as a static one. This could be an optimization path to be explored. The Static Python paper offer some explorations in this front. Our work on gradual type systems also introduces a novel approach to reduce the overhead between dynamic ↔ static while remaining sound. It is a pity though that the leading language for gradual types, which is TypeScript, cannot explore those routes as it transpiles to JS (otherwise we would likely have seen more advancements in this front).

Finally, it is worth remembering that gradual typing is a relative young discipline. For example, Richard mentions dynamic programming languages have features that were not meant to be statically typed. However, that’s a static (no pun intended) observation of the current status quo. There were features which were seen as dynamic or objected oriented in the past, until we were able to develop the theory necessary for them to become part of functional or statically typed languages. In fact, our work on the type system so far was exactly in researching and developing new theory to support all of existing Elixir features. It is not that Elixir is too dynamic, rather it takes on-going and exciting new work to type it. And it wouldn’t be surprising to see characteristics which are currently common to gradually typed languages (such as structural typing) to become more common on statically typed ones.

So overall: why dynamic languages? Because they are more expressive. Gradual type systems help formalize many of their features and provide red squiggly lines without affecting our expressive power. They are an argument in favor of dynamic languages, not against them.

11
Post #5
josevalim

josevalim

Creator of Elixir

Thank you for sharing @sundi and thank you for having us!

I have been live-streaming on Twitch and today livestream will be a Q&A session about types with myself and Guillaume Duboc (the PhD student working on a type system for Elixir). Join us today 22:00 CET / 16:00 ET / 13:00 PT at Twitch.

Bonus points if you listen to the episode and come back with additional questions! The stream will be recorded and available for 7 days. :slight_smile:

type1fool

type1fool

Who knew a discussion about typing could be so fun? Thank you for joining us and for all of the hard work!

type1fool

type1fool

After watching this talk from Richard Feldman, it sounds like gradual typing adds more complexity than full static typing. Is there something about the planned Elixir implementation or the nature of the BEAM which avoids the pitfalls he describes?

type1fool

type1fool

Excellent! Thank you for the thorough and thoughtful response.

Where Next?

Popular in Podcasts Top

brainlid
In episode 71 of Thinking Elixir, we catch up with German Velasco then talk about the 7-GUI Tasks online challenge and how he wanted to s...
New
wolf4earth
The Elixir Mix panel takes the helm to talk about helping onboard and transition new developers onto an Elixir team. They discuss helping...
New
brainlid
In episode 54 of Thinking Elixir, Lucas San Román explains his library Sourceror and how it was created to solve some AST parsing limitat...
New
brainlid
Securing our apps is our responsibility as developers. We are the custodians and the guardians of our user’s data. We met up again with M...
New
brainlid
In episode 57 of Thinking Elixir, we sat down with co-host Cade Ward to hear how he and his team tackled a problem of hosting live web ch...
New
brainlid
In episode 58 of Thinking Elixir, after covering the news we catch up on what Elixir things we’ve been thinking about and working on. Mar...
New
brainlid
Episode 123 of Thinking Elixir. Creator of the Ash Framework, Zach Daniel, shares how he feels Ecto is such a good tool, that people have...
New
brainlid
We go deeper on the Sobelow library, a security-focused static analysis tool for Elixir and Phoenix apps. We talk with Griffin Byatt, the...
New
brainlid
Episode 127 of Thinking Elixir. We talked with Spawnfest competitors Filipe Cabaço & Joel Carlbark about their entry “Lively”. Lively...
New
New

Other popular topics Top

chrismccord
Phoenix 1.4.0 released Phoenix 1.4 is out! This release ships with exciting new features, most notably with HTTP2 support, improved deve...
688 30048 115
New
sergio
In Ruby, I can go: User.find_by(email: "foobar@email.com").update(email: "hello@email.com") How can I do something similar in Elixir? ...
New
srinivasu
How to handle excepions in elixir? Suppose i have A, B, C ,D, E modules. and each module has get() function. A.get() method will call th...
New
JorisKok
I have a server on AWS, and was running a load test using artillery. When looking at the Phoenix dashboard I see the Ports going to 100% ...
New
albydarned
Hello all! I am typing this post from my new MacBook Pro with the M1 chip. I’m loving it so far, and will probably use it as my daily dr...
New
sergio_101
I am VERY much an elixir newbie. I have taken one elixir course and one phoenix course on Udemy. During that course, I saw the instructor...
New
nsuchy
Hi. I’ve noticed that Windows Powershell has it’s own IEX command and you cannot access Elixir’s IEX due to the conflict. This isn’t a cr...
New
qwerescape
Is there a way to get the call stack or stack trace at any point in the code? Not from exceptions, but an expression that returns how the...
New
stefanluptak
Hello everybody, usually, I use a 29" ultra-wide monitor for VSCode which can easily accomodate explorer (files panel) + file with code ...
New
WestKeys
Currently suffering from paralysis by [HTTP client] analysis. This is rather unusual in Elixirland as there tends to be consensus on the ...
New

We're in Beta

About us Mission Statement