Hacker News new | ask | show | jobs
by Arch-TK 990 days ago
Honestly, after years of writing python I have now gotten to a point where I fear dynamic typing.

The fact that Erlang and Elixir do not have static typing, outside of a voluntary type checker, makes me worry about using them. And yes, the approach to error handling in Erlang and Elixir is "let it crash" etc. The runtime debugging tools are excellent. There's approaches to design which ensure that even if there's some serious bug, you can still recover with minimal service loss except when your bug is something which automated testing should have caught but at this point I just feel: "Why deal with all that if you can have high quality static typing prevent you from having to deal with that in the first place?"

3 comments

This is a concern that I hear a lot and it really doesn't impact Elixir projects. You're getting the same thing in different ways thanks to pattern matching.

The defacto pattern matching approach for everything gives every function an interface and you still get strong typing for all of your core types too (numbers, strings, bytes, etc).

You just don't have static typing, but the typing that's there is significantly stronger than dynamic languages and IMO it has the perfect blend of wins from static typing without the flexibility impairments that come with it.

IMO, lack of support from strong typing leaves you with nothing but writing better code in general. Undoubtedly type checker prevents obviously/not that obviously invalid code, but if you can't catch it yourself, you're fucked :)

Although most elixir code I've worked with was written by guys coming from ruby/java, and they just couldn't resist abusing macros for emulating inheritance, or overusing macros per se, once you switch your mind and clean that shit up, elixir is more maintainable than golang, for example (working for go company now). It has more tools to manage complexity and boilerplate, while nearly all golang code is complex/boilerplate itself.

dynamic typing allows for hot code swaps. which is super important for systems that need 24/7 uptime.