josevalim

josevalim

Creator of Elixir

Type system updates: moving from research into development

I hereby officially announce the Elixir type system effort is transitioning from research into development. Read the full-announcement here: Type system updates: moving from research into development - The Elixir programming language

This new exciting development stage is sponsored by Fresha (they are hiring!), Starfish* (they are hiring!), and Dashbit.

Thank you!

639 11511 165

Most Liked

josevalim

josevalim

Creator of Elixir

There are a few details I don’t appreciate about how we implemented typespecs (for example, I find them too verbose) but the deal breaker here is that typespecs are not capable of expressing the proposed type system, so we will need something new.

27
Post #8
lifeofdan

lifeofdan

I had to create an account here just to say how much I love this. This is incredibly exciting!

josevalim

josevalim

Creator of Elixir

The type system allows us to support any literal as type but it is still undecided if we want to do that. Opposite to the Dialyzer, an actual type system will be strict about the expected arguments. Imagine this code:

$ :foo or :bar -> string
def foo_or_bar(:foo), do: ...
def foo_or_bar(:bar), do: ...

Now imagine you call it like this:

foo_or_bar(String.to_existing_atom(string))

Because you are passing any atom to the function, the type system will warn about a type error. While Dialyzer would never warn. So you would need to write this instead:

case String.to_existing_atom(string) do
  :foo -> foo_or_bar(:foo)
  :bar -> foo_or_bar(:bar)
  _ -> raise "expected foo or bar"
end

Therefore, more specific types will require you to prove that you are passing those specific types and that may actually make the type system more annoying than helpful.

Since there are trade-offs here, it is a decision we will make later once we have a better feeling for the type system.

Correct.

OndrejValenta

OndrejValenta

Sweet Jesus, Halelujah!

Working with Elixir/Phoenix daily, you slowly get used to some level of pain and suffering, typo here, wrong return tuple here, wrong atom elsewhere. You start see it as part of the job.

But then, you switch back to ASP.NET for another project, like we do in my team, and you find out the pain is gone, there is no more suffering, you write more but you can relax, you can trust the system, if it compiles you are good, if it doesn’t it tells you right away where you made a mistake. With ReSharper and continuous compilation I can see all compilation errors right away, after every change.

As much, as I prefer Elixir/Phoenix for production systems and we introduced some into DHL, this is an enormous problem for us, the trust in the code is simply not there.

zachallaun

zachallaun

This is great to hear. Huge congrats to everyone involved. I’m sure I’m not the only one here eager to see these ideas translated to code. :slight_smile:

I’d like to especially extend congratulations to Guillaume Duboc – not every PhD candidate has the opportunity for their work to make such a direct and significant impact. It must be extremely exciting!

16
Post #9

Where Next?

Popular in News Top

Elixir
1. Bug fixes Elixir [bin/elixir] Properly handle the --dbg flag in Elixir’s CLI [Code.Formatter] Add brackets around keyword lists when ...
New
josevalim
The goal of private modules is to define a module that cannot be trivially accessed by other modules where they are not visible to. In t...
New
josevalim
I hereby officially announce the Elixir type system effort is transitioning from research into development. Read the full-announcement he...
639 11510 165
New
Elixir
Release: https://github.com/elixir-lang/elixir/releases/tag/v1.11.1 1. Bug fixes Elixir [Code] Ignore tracers if lexical tracker is dea...
New
Elixir
Release: https://github.com/elixir-lang/elixir/releases/tag/v1.11.0 Over the last releases, the Elixir team has been focusing on the com...
New
josevalim
This is a small release with important bug fixes for those using Cover and Dialyzer on Erlang 19. See the release notes for more info: ...
New
josevalim
Release: https://github.com/elixir-lang/elixir/releases/tag/v1.13.3 1. Enhancements Mix [mix format] Supply file and line to formatter ...
New
jola
Hey everyone! It’s my enormous pleasure to present Hex Diff, an official hex.pm service for generating web-based diffs between package ve...
New
Elixir
Release: Release v1.13.0-rc.0 · elixir-lang/elixir · GitHub The focus behind Elixir v1.13 has been on tooling, mainly tooling related to...
New
Elixir
Release: https://github.com/elixir-lang/elixir/releases/tag/v1.10.0-rc.0 Support for Erlang/OTP 21+ Elixir v1.10 requires Erlang/OTP 21+...
New

Other popular topics Top

JakeBecker
TL;DR: I’ve just released an implementation of Microsoft’s IDE-independent Language Server Protocol for Elixir. It adds language support ...
1140 51847 244
New
sergio
I couldn’t find any guides that worked well with Phoenix 1.6.0 and esbuild. I hope this helps people test the waters and eases you into t...
New
_russellb
I want to try my hand at web scraping. What tools/libraries do I need to use. I’m hoping to turn this into something professional so don’...
New
lastday4you
I wanted to check elixir version in phoenix because i found that my elixir is 1.5 but when i use Enum.chunk_by it said the function is un...
New
mcarvalho
What is the difference between System.get_env and Application.get_env? For example, what are best practices to use one versus another.
New
rms.mrcs
Hi, I need to transform a list of numbers into a map where the keys are the indexes and the values are the original values of the list....
New
ashish173
I am using Ecto timestamps with postgres, I can see the timestamps() use the :naive_dateime but for my use case I wanted to store the ti...
New
shahryarjb
Hello, I have map which I want to convert it to string like this: the map: %{last_name: "tavakkoli", name: "shahryar"} the string I ne...
New
chrisalley
ExUnit now has describe blocks which is a welcome addition coming from RSpec. In the docs, it states that nested hierarchies of describe ...
New
belgoros
I’m not a pro in using Regex and can’t figure out why the following behaviour happens, especially if we take into account the difference ...
New

We're in Beta

About us Mission Statement