arcanemachine
Jose Valim: "Elixir is, officially, a gradually typed language"
Most Liked
josevalim
You misread his reply but keep in mind this is not a good way to approach the discussion. We will definitely make mistakes as we implement the type system and I hope the feedback will be more constructive than the above.
Engage constructively. If you think it is bad, just don’t say it, argue your case with examples. Provide context and propose alternatives if possible.
josevalim
We have been considering these aspects for sure, but it is too early to focus on them in general, given we are still working on the semantics of the type system.
We have discussed this a couple times, so I am not going to rehash all points again, but there is already too much that can happen in function clauses and we don’t want to add more. I bet no one want to see this code:
def foo({_, _} = bar \\ {:foo, :bar} :: {atom(), atom()}) :: integer()
Furthermore, a function specification and its implementation are two separate things. In Typescript, you can’t have multiple clauses (afaik). In Elixir, if we tie the specification to the clauses, there is a chance you will accidentally change the specification when moving clauses around and when refactoring code, and by doing so you will get in the way of the type system.
At this moment, I’d say we should put signatures after the docs and grouped immediately before the first clause, since they help both with the documentation and code. And I want them grouped because I want a unified view of how my function behaves and not scattered across multiple lines.
But maybe I will change my mind in 6 months or in 2 years. In order to figure out the best approach, we will need to try and explore things. It hasn’t been a week since the compiler got a rudimentary understanding of types and type signatures certainly won’t happen this year.
Now it is definitely too early. All we are asking for is patience, patience with our work, and patience between yourselves. Let’s not rush this. The worst we can do is to standardize into something sub-optimal because we were too quick to settle.
josevalim
Thank you @Fl4m3Ph03n1x!
To align everyone’s expectations, our goal is to perform inference of all patterns and guards by Elixir v1.17, as outlined here: Type system updates: moving from research into development - The Elixir programming language
There are still no typing syntax or changes to the language.
And there is still a chance we won’t go forward with this. But this is a very exciting step for sure.
Popular in Discussions
Other popular topics
Categories:
Sub Categories:
Forums
Popular Tags
- #ecto
- #liveview
- #troubleshooting
- #learning-elixir
- #deployment
- #library
- #erlang
- #testing
- #genserver
- #mix
- #absinthe
- #remote-other
- #otp
- #plug
- #how-to-question
- #macros
- #postgres
- #channels
- #elixirconf
- #exunit
- #discussion
- #code-sync
- #javascript
- #podcasts
- #onsite
- #dialyzer
- #docker
- #authentication
- #umbrella
- #full-time-contract
- #podcasts-by-brainlid
- #ecto-query
- #elixir-ls
- #phoenix_html
- #iex
- #blog-post
- #graphql
- #genstage
- #ai
- #websockets
- #supervisor
- #advent-of-code
- #elixirconf-us
- #distillery
- #processes
- #forms
- #api
- #metaprogramming
- #security
- #performance









