Hacker News new | ask | show | jobs
by reledi 2247 days ago
Definitely. When I go back to Elixir from Go I feel the pain of not having static types.

AFAIK, the closest we have right now is

- typespecs

- guard clauses

- structs w/ required keys (cannot specify types)

- ecto embedded schemas (e.g. structs with "typed" fields)

2 comments

I don't care that much between dynamic and strict types but I like strict typing.

So yeah typesecs and guard clauses cover a lot of that (and the ever fun dialyxir) but it's more cumbersome than just typing your function parameters and variables.

And funnily enough in the end what I miss the most is the type hinting when I write function calls. I use Intellij and the elixir plugin doesn't support that AFAIK, it's a real productivity killer.

After using Elixir for almost a year professionally, I find structs/schemas to be fairly useless when it comes to type safety. These are essentially just maps, there is absolutely no guarantees, anywhere in your code, that your map was created properly, and went through the proper set of validations.

When I get a `Point` struct, I have no guarantee that the wrapped lat/long are actually valid. After 15 years of static typing this is just so stressful :)