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 74 of Thinking Elixir, we talk with mother and daughter team Miki and Kate Rezentes about their experiences learning and worki...
New
brainlid
We talk with Peter Ullrich about his experience sending SMS messages from a Raspberry Pi Zero using Nerves. We cover what went well, what...
New
wolf4earth
David Yamnitsky joins the mix to discuss tangram.dev and how to use it to add Machine Learning features to your Elixir applications. He ...
New
brainlid
Episode 137 of Thinking Elixir. After covering the week’s news, we talk about upgrading our apps to Phoenix 1.7.0 and what the experience...
New
brainlid
https://thinkingelixir.com/podcast-episodes/051-live-auctions-with-alex-loukissas Posted via Devtalk (see this thread for details).
New
brainlid
In episode 73 of Thinking Elixir, we talk with Paul Copplestone, founder and CEO of Supabase. Supabase leverages the power of Elixir, Pos...
New
brainlid
Some people excitedly talk about the “end of localhost development” when developer machines move to the cloud. Presumably this is better ...
New
brainlid
Episode 181 of Thinking Elixir. In this week’s episode, we ignite the exciting world of Elixir with Chris McCord’s announcement of FLAME,...
New
brainlid
Episode 222 of Thinking Elixir. News includes the release of OTP 27.1 with significant improvements to the Zip module, the upcoming depre...
New
brainlid
Episode 120 of Thinking Elixir. Localizing and personalizing an application is separate from the language used in the interface. Kip Cole...
New

Other popular topics Top

Brian
What is the proper way to load a module from a file in to IEX? In the python world, doing something like this pretty standard: from ....
New
openscript
Hello! Sorry for this astonishing simple question, but I’m really stuck. I try to set up the intellij-elixir plugin, but I don’t know ho...
New
joaquinalcerro
Hi there, I am working with Ecto-Postgresql and I need to call all of the records from a specific table but the table has 40,000 record...
New
Harrisonl
We have an ECS cluster with 4 services, where each task joins a single cluster, via discovery ECS discovery service. Currently when I de...
New
vertexbuffer
Hello, can anybody help here..? I have a list of players and I what to delete an element, but every for loop the list is reverting to ori...
New
script
If I have a string “1000 cfu/ml” . I want to remove the characters and / and space . So the string is like this "1000" What is the ...
New
fayddelight
I tried installing elixir 1.11.2 erlang 23.3.4 via asdf in my zsh shell. Enabled the versions locally and globally. When I list them ...
New
fireproofsocks
Forgive me if this is obvious, but how does one delete a database record WITHOUT selecting it first? https://hexdocs.pm/ecto/Ecto.Repo.h...
New
AstonJ
We’ve put together this wiki for Phoenix LiveView - please feel free to add any info you feel is worth including. What is Phoenix LiveV...
New
lanycrost
Hi everyone! I need implement if…else if…else condition from my elixir code, and anymore of this control flow structures not work proper...
New

We're in Beta

About us Mission Statement