What are your concerns about a future type system for Elixir?

  1. Typecasting: I want to somehow type data structures, and ensure that either I have something like this in my hands or fail hard and fast in my code. Like, interacting with external APIs where I cast/transform received data into something more usable first thing in my code - the ability to hard cast eliminates a lot of “if” branches later on in the code. My fear: we get types without the casting, like in typescript. I want: in an ideal world something like serde in rust, where I can encode/decode stuff right From/Into (json/xml/…). A huge percentage of company business code usually is concerned with casting data shapes back-and-forth, so for me personally this would be a killer feature.

  2. duplication: the new types should automatically generate dialyzer specs or vice versa somehow - additional markup ontop of functions would be bad.

  3. compilation times: this already is noticeably bad when there is a big phoenix monolith with lots of code and dependencies and then ontop of it dialyzer runs from scratch for a significant amount of time. I see why it is that way and understand the reasons, but at least it shouldn’t get much slower.

3 Likes