2. Depending on the framework you use (we just use cowboy directly), Erlang HTTP pages/endpoints are pretty light on state as well, you need to pass them information or call global functions to make them stateful. Maybe I'm not getting you right here.
3. This is an issue to me as well, but I think most Elixir and Erlang developers would agree that this would really be nice to have, at least optionally. We're right now in the process of making our codebase "dialyzer-safe" but there are so many parts of it that could be checked statically. From what I got from different talks and articles on the subject, the main issues are the dynamic "dispatch" mechanisms, like throw/error/exit and general message passing that allow for arbitrarily typed data to be thrown at arbitrary other code.
Elixir was inspired by Ruby iirc and it was a project started in 2012 according to the elixir documentary by Honey.
Scripting languages without static typing have its place.
I don't believe all languages even new one starting in 2018 should be type. It depends on the language goals.
If you want a actor concurrency model with type then try Pony.
Is this actually a problem? The macros are not really overused, most library developers are sane about limiting the use of macros, and the lexical scope of any given macros is limited by the require/include semantics. "use" is pretty bizarre, but I've never had a problem with "just roll with it"
No one knows how to do it. It is an open research problem and we are far from a solution still.
Erlang already has a dual nature:
- the sequential part, which strives to be a pure and mostly side-effect free functional language
- the concurrent part, i.e. send, receive, process preemption, message delivery semantics, etc, which is inherently stateful due to interactions between stateful processes
Gradual typing fits this model well, because it provides soundness to the sequential part of the language, while leaves the message passing parts which _no one knows how to_ type dynamically typed.
BTW, I've spent a while to integrate Gradualizer with Vim - https://github.com/neomake/neomake/pull/2115
Its a tradeoff -- do you go with untyped BEAM concurrency or typed concurrency like in golang.
In Go you have to write code to catch unwanted error and figure out what can go wrong.
So there are many things in Erlang where it soften this no type weakness.
Elixir is definitely a darling of HN but there are some areas where there are some shortcomings in my point of view:
- A lot of people seem to love Elixir macros but I actually think that they result in a lot of compile time magic and make the code difficult to debug/read. Macros make code easy to write but supremely difficult to behind-the-scenes-understand and debug. The code that you write is transformed into something very different when you run it! Also every major Elixir library brings its own special macros which is a pain. Erlang OTOH does not use user defined code transformations (i.e. macros) so much so the code there is easier to comprehend. But the Erlang language is quite barebones and does not have the expressive power of some of its functional cousins like OCaml/ML/Haskell. Its seems that macros were an easy way to impart this expressive power to Elixir but it comes with the above mentioned costs.
- The Elixir (Erlang) runtime is stateful. This leads to many advantages but I kinda love the PHP model of every request is isolated/new from the rest of the system also. This may make PHP feel clunky/slowish but then its super easy to debug. PHP works out fine for _most_ systems even at scale. If your system does not have extreme requirements then PHP should work out fine.
- Elixir is not statically typed. In 2018 for a new project its hard to justify not using a typed system to make code more likely to "run" properly out of the gate or increase your confidence while refactoring it. Even a simple type system like golang's will do. No need for something complex like C++/Java/Rust etc.
In summary there is a lot of good in the Erlang/Elixir ecosystem. I think it makes sense to use this platform in many scenarios.
P.S. I've talked about PHP above. It continues to be fashionable to bash PHP and I feel this is a meme that must be combated. PHP 7.x is a much improved platform. Once you look past some of its historical warts you'll find that it can be very productive to work in. Of course it lacks static typing but if you specify the types of the your function parameters and (comment) annotate the type variables you can get some of the benefits of typing if you have the correct IDE/code analysis tools. (Elixir/Erlang also have "soft" static typing via dialyzer).