Types? What are these “types” you speak of? (Nothing)
0voters
The poll allows up to 2 votes for cases where people have a preferred tool for Elixir and a separate preferred tool for Erlang or they simply can’t choose a favorite.
If you chose a tool on the poll (or answered “other”), what do you use, why do you use it, and how do you use it?
If you don’t use any form of type checking tool, do you still bother maintaining typespecs? Is there some other process or tool you use besides the usual manual code review and unit/integration testing?
If you use Dialyxir/Dialyzer, have you figured out how to use the new --incremental mode? As far as I can tell, incremental mode is not usable on Elixir code (yet).
If you don’t use any form of type checking tool, do you still bother maintaining typespecs?
Yes, althought I’m sorta bipolar about this. On the one hand, they really help as docs. On the other hand, at times writing them, while knowing that they ultimately mean nothing as they aren’t enforced, feels rather pointless.
I always try to use Dialyzer and typespecs as much as possible. Even for project where I don’t use Dialyzer, typespecs are used.
At work, Dialyzer warning are tracked by our CI-tool. Builds don’t fail when introducing Dialyzer warnings, but there is a strict agreement om fixing those warnings as quick as possible.
I have tried several of the other tools, but they simply don’t work on our code base - they usually crash in one way or another.
Would love some faster and more accurate type analyser tools, but for now Dialyzer works and does indeed find potential issues.
I have also considered doing that, but haven’t had the time to look into it properly.
So if you can share anything about how this works out for you, I would be really interested!
I will! Currently I’m writing a little code generation thing so that I can read Ecto schema structs in a type safe way in Gleam (I’m calling it Neglecto). But I’ll post a separate thread about it if it goes somewhere.
With regards to alternative BEAM languages, I’m currently learning Purerl, which is Purescript with Erlang as the backend. The interop story is very good: running PS code from Elixir is very easy, and FFI in Purescript seems to also be frictionless. They also have OTP, Gun, etc bindings. However, I can see why it didn’t get more traction: I’ve been studying it for a couple weeks, I’ve writtern monad transformers but I still don’t know how to make a simple GET request . But, it’s fun and powerful, so I’m looking forward to learn it and eventually use it with my Elixir code.
I forgot all about that… Purescript and its’ many backends. I’ve used purescript in the browser. I’m just learning phoenix (and that uses Elixir). Sticking to the defaults for now. But purescript for a library might be tempting… How is the performance overhead / what does the generated code look like?
That dynamic with the GET request sounds familliar… But it’s fun.
Can’t tell because I haven’t written any “actual” code yet, the book I’m going through focuses on the theory first, but I’m assuming it to be about the same as what I would’ve written anyways because BEAM itself is quite optimized.
what does the generated code look like?
I don’t know Erlang so can’t comment much on this either. I can’t find the source now, but I remember reading somewhere that the author of Purerl decided to not prioritize readability of the output Erlang code. On the other hand, standard library code looks fairly comprehensible to me. Also it’s worth noting that exported functions are all curried, but also overloaded non-curried ones are generated too. Another fun thing is that it looks like that for some of the built-in functions, when calling them from Erlang/Elixir, you’d have to specify their type, e.g.:
iex(1)> :data_tuple@ps.fst {:tuple, 1, 2}
1
But I don’t remember having this when I was testing out creating/manipulating ETS tables from PS, from IEx.
That dynamic with the GET request sounds familliar… But it’s fun.
Yeah and FWIW in PS with Node as the backend it’s much easier because of the Affjax library and a couple examples. In Purerl it’s just Gun which is quite low-level itself and then on top of this there are literally zero docs. But the language itself is very expressive and overall just amazing, I’m enjoying it so far.
With regards to currying, I’ve recently ran some simple tests in Elixir (for clarity – in Elixir alone). The extra overhead was ~25%, regardless of the number of arguments – quite tolerable for me.
Here is some sample code from Data.List:
dialyzer through elixir-ls. It broke for me years ago on all my machines so i do not anymore. I should try again
yes i try to use typespecs anyway for people that do use it. And for myself. But ofc it would be far nicer if i still had typer integration in my editor… But that broke too.
no use of incremental. Never needed it plus too new
not tried eqwalizer. Would love to try gradient but it says on the tin not ready, so…
Unfortunately there is a notable performance overhead with PureScript due to its use of unmonomorphised type classes, and the generated code is quite unfriendly if you’re trying to use it from Erlang or Elixir.
Gleam is designed for this use case so doesn’t have these problems, but does have the same level of type safety.