News for hackers. Stuff that matters.
Re:Changelog for Elixir v1.11 by jswny on Saturday September 12, 2020 @11:35AM (#24453233)
It depends on what you are struggling with. If you want formal type documentation and some decent type checking, Dialyzer is pretty good. That’s really the only solution for Elixir.

If you want full static type checking, there is https://gleam.run/ which is a new language, and there’s also something that seems like a full static type checker for Erlang which is going to be released by Facebook soon (they use it internally). See this: https://elixirforum.com/t/facebook-is-writing-a-new-statical....

I, for one, am hoping that the Facebook solution allows us to implement something in Elixir to interface with it so that we can take advantage of it in Elixir, but that is yet to be seen.

Re:Changelog for Elixir v1.11 by Kaze404 on Saturday September 12, 2020 @11:40AM (#24453267)
I've been using Dialyzer and it works well enough most of the time. Maybe the Elm compiler spoiled me, but when Dialyzer tells me "this pattern will never match" and not offer me tools to fix it, it's very frustrating. I'm not sure if it's possible, but it would be nice to have an action to autocomplete missing patterns like in Elm / Rust.

That said, I'll take a look at Gleam. Thank you

Re:Changelog for Elixir v1.11 by elcritch on Saturday September 12, 2020 @03:34PM (#24454898)
Dialyzer messages can be pretty obtuse. Usually I take it as a cue to just re-read the function and it's often somewhat clear where the problem lies due to immutability (not always though).

Another trick I'll do, is to use (abuse) pattern matching:

    def foo(%SomeStruct{} = arg, value) when is_integer(value) ...
That also helps Dialyzer narrow down possibilities too and will blow up on runtime.

If you use VSCode, the ElixirLS module will auto-suggest @spec's for your functions.

Re:Changelog for Elixir v1.11 by jswny on Saturday September 12, 2020 @11:59AM (#24453381)
Yeah the big problems with Dialyzer are that it can be slow at times and that the error messages are not great. However, a lot of the error messages are the same esoteric messages, and you can get used to debugging them when you know what they are trying to call out.
Re:Changelog for Elixir v1.11 by lpil on Wednesday September 16, 2020 @09:22AM (#24492434)
Hello! I'm the creator of Gleam.

From talking to the WhatsApp Erlang team a little it seems unlikely unlikely that the Erlang type checker will be usable with Elixir I'm afraid.