top | item 41381527

(no title)

jonnycat | 1 year ago

I'm not sure... I'm a huge Elixir fan and I trust José to build a great solution, but I've found the rollout to be a bit confusing. There was the announcement that "Elixir is now a gradually typed language" prior to 1.17 - but it seems that most of the changes were behind the scenes, and 1.17 largely didn't expose user-facing type errors or warnings.

Again, I definitely trust them to get it right in the long term, but in the meantime, the progress has been a bit confusing to me.

discuss

order

josevalim|1 year ago

Thanks for vote of confidence!

We need to type every data type and every function, so the type system will be rolled out over a long period of time.

The 1.17 release meant that we now have a gradual type system, which runs in every code being compiled, but it only supports a handful of types (including the dynamic one). The full list of supported types and examples of typing violations it can now detect is on the announcement: https://elixir-lang.org/blog/2024/06/12/elixir-v1-17-0-relea...

There is no support for type annotations, that comes in a later stage. The overall stages have been described in an earlier article (and I believe also in the paper): https://elixir-lang.org/blog/2023/06/22/type-system-updates-...

klibertp|1 year ago

> but it seems that most of the changes were behind the scenes, and 1.17 largely didn't expose user-facing type errors or warnings.

That's how it normally goes with gradual type systems for existing languages, I think. The first step seems to be almost always adding a type checker that doesn't do anything in particular other than handling untyped code. Since being able to handle untyped code makes a type system gradual, announcing Elixir as "gradually typed" when this milestone is reached seems justified. After that, you're free to improve the type system and type checker(s), improve type inference, add specialized syntax, improve typed/untyped interactions, cover more language patterns, and so on. MyPy for Python also started without support for many things that were added later (and it's still being actively developed ten years later).

sodapopcan|1 year ago

The wording was a little odd, but there are certainly user-facing errors in 1.17, namely:

- Map keys (called with '.') are checked at compile time.

- Using comparison operators with different types causes a warning.

I may be forgetting something.